max-heller / mdbook-pandoc

A mdbook backend powered by Pandoc.
Apache License 2.0
97 stars 7 forks source link

Links to chapters are broken when using Pandoc 3.2 or later #99

Closed max-heller closed 2 months ago

max-heller commented 2 months ago

Pandoc used to inject an anchor at the beginning of each file when --file-scope was used, and mdbook-pandoc could use these to link to the start of a chapter. This behavior was recently removed in https://github.com/jgm/pandoc/commit/30442b7f9d27150c249a8381fe8a5ca5a460db63

To get around this, mdbook-pandoc will have to find or inject a different anchor at the beginning of each chapter. This should usually be achievable by finding the identifier of the first heading in the chapter (expected to be the first thing in the chapter), but it's unclear how to handle a chapter that doesn't start with a heading (see https://github.com/jgm/pandoc/issues/9200#issuecomment-1817673216 for discussion).