jgm / djot.js

JavaScript implementation of djot
MIT License
155 stars 18 forks source link

Parsing Djot vs Pandoc AST results in different nodes having identifiers in unexpected ways #96

Closed irskep closed 2 months ago

irskep commented 2 months ago

I'm writing a tool that processes mixed Djot and Markdown. If I parse Djot and put an ID above a heading, it ends up on the section tag as a parent of the heading. But if I parse Markdown, the ID ends up on the heading itself.

djot:
<section id="Foo"><heading level=1>Foo</heading></section>

md:
<heading level=1 id="Foo">Foo</heading>

This isn't a problem per se, but I was surprised because I expected Djot to put its AST in roughly the same shape regardless of input format. I suppose Markdown doesn't try to put its content in a section structure at all. Feel free to close if this is expected, or consider documenting the differences.

jgm commented 2 months ago

If you use --section-divs, you'll get a similar effect with Markdown.