codimd
codimd copied to clipboard
Parsing Code Fence Parameters causes TypeError
Context
I'm using code fence parameters for my pandoc pipeline to render plantuml diagrams using pandoc's diagram filter. Unfortunately, the mandatory syntax ```{#fig:use-cases .plantuml caption="foo"} causes codimd to throw an error while parsing the parameters.
Workaround
Switch to Edit-Mode (by changing the URL's query param to ?edit) and remove the causing line.
Cause
codimd is capable of parsing the expression above, the function is called parseFenceCodeParams. There is a Not-Operator missing that causes the class property to never be initialized. The next line fails due to the uninitialized property.
https://github.com/hackmdio/codimd/blob/ded6b5856f988ec6900a341a33a164a0c1ae3e12/public/js/lib/markdown/utils.js#L12-L13