3 ms·
> [Markdown] allows embedding arbitrary HTML code, both at the block and at the flow level. That makes writing any parser for it very hard because you basically
by paulddraper 3y ago
> [Markdown] allows embedding arbitrary HTML code, both at the block and at the flow level. That makes writing any parser for it very hard because you basically have to include a full HTML parser and then add context sensitive complications...You also have to worry about all the security caveats of HTML. For example, HTML allows embedding Javascript, so you get to implement a Javascript interpreter as well, and to secure it.
Is it just me, or is a JavaScript interpreter irrelevant to a Markdown parser?
- klardotsh 3y agoIt is. I know of zero Markdown implementations off the top of my head that bother to parse JavaScript - if there's JS embedded in HTML embedded in Markdown, it gets passed through as a block element on the HTML side (which may or may not be parsed, either). TFA is drawing at straws to dunk on a format they don't like.
- OkayPhysicist 3y ago#Heading Here's why allowing arbitrary HTML and JS in your Markdown makes parsing painful <script> console.log("</script> is a closing tag for script blocks"); </script>
- gorkish 3y agoMarkdown "supports" embedded HTML but that does not mean that your chosen implementation must support it. Personally, I think it's a misfeature and wouldn't want to touch any markdown lib that tried to put too much emphasis on something like validating or sanitizing HTML and Javascript. That's a project with too much scope creep.