Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle special characters in markdown?

I am just discovering Markdown and MultiMarkdown and I am loving it so far. However, special characters are not properly escaped when exporting to HTML and come out as garbage in the browser.

Example:

How does Markdown handle special characters?
============================================

For example, German is full of ä, ö, ü and ß.

is converted to

<h1 id="howdoesmarkdownhandlespecialcharacters">How does Markdown handle special characters?</h1>

<p>For example, German is full of ä, ö, ü and ß.</p>

Since I have to write in German a lot, entering the escape sequences by hand is not an option. How can I get HTML output with properly escaped special characters?

like image 451
clstaudt Avatar asked Oct 05 '12 13:10

clstaudt


People also ask

How do you show asterisk in markdown?

Escape '*' by using '\*' instead Markdown is quite sensitive to whitespace. If you don't put spaces around the * (line 3 below) you get the problem you're describing (markdown assumes the *s are italic-delimiters).

How do you escape special characters?

Escape CharactersUse the backslash character to escape a single character or symbol. Only the character immediately following the backslash is escaped. Note: If you use braces to escape an individual character within a word, the character is escaped, but the word is broken into three tokens.

How do you escape the markdown period?

Note that the period ("dot") is included in this list. Therefore, a single backslash preceding a period simply escapes the period.


2 Answers

I do not know if this scenario apply to you, but here goes:

I have the same need regarding the Norwegian letters 'æ', 'ø' and 'å'. I use FireFox and the add-on 'Markdown Viewer' to view markdown documents.

Viewing a Norwegian document in Markdown Viewer will render garbled letters if the document is saved in the ordinary manner.

Saving the document using western (windows 1252) encoding renders the text just fine (I also tried with your German letters).

like image 89
JustAnotherCoder Avatar answered Oct 10 '22 10:10

JustAnotherCoder


As far as I know, this is not possible (though I would be happy to be proven wrong). I have recently been generating documentation in Doxygen using Markdown syntax and have had to replace all ° symbols with &deg;, which is a shame as it goes against the philosophy of Markdown, which is to make the text files as readable as the generated output.

like image 36
PeterByte Avatar answered Oct 10 '22 10:10

PeterByte