SabrinaJewson / cmarker.typ

Transpile CommonMark Markdown to Typst, from within Typst!
MIT License
30 stars 2 forks source link

Supporting Markdown footnotes #3

Open SabrinaJewson opened 1 year ago

SabrinaJewson commented 1 year ago

Markdown has footnotes, and we could support them in cmarker. The main difficulty here is that the Markdown parser gives us footnotes in an out-of-band format, whereäs Typst expects them in an in-band format, and so our current single-pass approach would be insufficient. I think I would only like to parse the Markdown once, so the strategy I would choose is building a Vec<(usize, CowStr<'_>)> of “places we need to insert a footnote” in our single pass, then add a second pass to fill them in.