bgamari / trac-to-remarkup

Moved to GitLab: https://gitlab.haskell.org/bgamari/trac-to-remarkup
https://gitlab.haskell.org
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Escaping in Markdown #21

Closed tdammers closed 5 years ago

tdammers commented 5 years ago

When rendering Markdown, we need to handle text content that might otherwise interfere with Markdown syntax, e.g., literal * in plain-text nodes.

A fairly simple approach is to simply escape all characters in text nodes that are somehow special in Markdown. It works, and renders correctly; the downside however is that this also causes a lot of unnecessary escaping, because those special characters aren't special in all contexts, only when they form valid Markdown syntax. E.g., ( is special in a link context: [title](url), but not in other contexts: this is fine (no escaping needed).

5192ce0 implements this simple approach; it works.

A better approach would be considerably more complex; in fact, I don't have any recipe at hand for doing it properly, so I suggest we leave it as is, and accept a bit of noise in the wiki sources.

bgamari commented 5 years ago

2610f877343bb2dd942d006456a9605536e71928 further improved the situation. I believe this can be considered fixed.