LegNeato / mdbook-typst

An mdBook backend to output Typst markup, pdf, png, or svg
51 stars 3 forks source link

Backslashes inside backticks are not escaped properly #3

Closed rix0rrr closed 7 months ago

rix0rrr commented 7 months ago

The following MarkDown:

before `\` after

Is translated into the following Typst:

#par()[before #raw("\") after]

But in Typst, the \ escapes the following " and so the string is never closed, leading to the following error:

error: unclosed delimiter
   ┌─ book/typst/book.typst:38:6
   │
38 │ #par()[before #raw("\") after]
   │       ^

According to the CommonMark spec, backslashes inside code blocks are not escaping anything and should be preserved literally:

Backslash escapes do not work in code blocks, code spans, autolinks, or raw HTML:

https://spec.commonmark.org/0.31.2/#backslash-escapes

LegNeato commented 7 months ago

Thanks for the report! I'll try to fix this in the next couple days

LegNeato commented 7 months ago

This should be fixed and published now, let me know if it is still an issue!

rix0rrr commented 7 months ago

Thank you!