MichaelHatherly / CommonMark.jl

A CommonMark-compliant Markdown parser for Julia.
Other
84 stars 11 forks source link

Newline `\n` is not preserved in latex output for codeblocks #3

Closed JanisErdmanis closed 4 years ago

JanisErdmanis commented 4 years ago

I am currently trying to move from LaTeX to Markdown for writing an article which contains some code. For code blocks which get put into verbatim environment I found that \n is not preserved and as well _ is being escaped with \, whereas in html output such things does not happen. MWE:

using CommonMark
markdown = Parser()
ast = markdown("""```
x_i = 1
y = 2
```""") 

html(ast) gives "<pre><code>x_i = 1\ny = 2\n</code></pre>\n" whereas latex(ast) is "\\begin{verbatim}\nx\\_i = 1y = 2\n\\end{verbatim}\n".

MichaelHatherly commented 4 years ago

This is fixed in latest master I believe, I assume you're on 0.2.0?

JanisErdmanis commented 4 years ago

Yes, I was on v0.2.0. Master indeed fixes the bug :)

MichaelHatherly commented 4 years ago

I'll release a 0.3 sometime this week so you won't need to remain on master for too long.

MichaelHatherly commented 4 years ago

https://github.com/MichaelHatherly/CommonMark.jl/commit/98f42134300c2af7630e05f5fe62d9c38accb7eb will have the fixes you need @akels.