lierdakil / pandoc-crossref

Pandoc filter for cross-references
https://lierdakil.github.io/pandoc-crossref/
GNU General Public License v2.0
909 stars 73 forks source link

[feature request] support native typst references #431

Open pbsds opened 2 months ago

pbsds commented 2 months ago

Currently pandoc-crossref when targeting typst replace references with text+hyperlinks as it would for html, and will append \quad (<number>) in equations.

Would it be possible to support native references in typst? This will improve mapping between markdown and typst, allowing authors to cooperate in the format they prefer to work in.

https://typst.app/docs/reference/model/ref/

lierdakil commented 2 months ago

I did this for LaTeX, and frankly I think it was a mistake. Ultimately, I ended up in the situation where features available for other output formats are not supported by LaTeX and vice versa, and there's no easy fix (apart from reimplementing the whole of pandoc-crossref logic in LaTeX, which is not something I'm willing to do, and it would be ultimately rather pointless).

If you just want to translate references between the pandoc-crossref format and something else, without any nifty extra features (which for compatibility you have to eschew), it could be achieved with a relatively simple Lua filter. Just take citations (yes, we're using citation syntax for references) and convert them to raw blocks in the target format. There are some edge cases, but they're comparatively few.

P.S. Since I don't use typst, and don't plan to, I'm certainly not the best person for the job.