Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: work around Pandoc 3.2+ breaking links to chapters #100

Merged
merged 12 commits into from
Jun 25, 2024
Merged

Conversation

max-heller
Copy link
Owner

@max-heller max-heller commented Jun 23, 2024

Pandoc used to wrap the contents of each file in a div when --file-scope was used, which mdbook-pandoc relied on to link to the start of a chapter. This behavior was removed in jgm/pandoc@30442b7, which was released in version 3.2.

To work around this, mdbook-pandoc now searches for the first heading in each chapter and, if present, links to this heading as a proxy for the beginning of the chapter. This should make sense in most cases, since mdBook chapters tend to start with a top-level heading, but will result in regressions if chapters don't contain any headings or the headings they do contain don't have a usable identifier (this is the case with punctuation-only headings, for instance). See the Pandoc manual for the algorithm used to generate identifiers for headings.

Closes #99

@max-heller max-heller marked this pull request as draft June 23, 2024 22:57
@max-heller max-heller changed the title WIP: work around pandoc 3.2 no longer wrapping file contents in divs fix!: work around Pandoc 3.2+ breaking links to chapters Jun 25, 2024
@max-heller max-heller marked this pull request as ready for review June 25, 2024 17:07
@max-heller max-heller merged commit 21a287d into main Jun 25, 2024
20 checks passed
@max-heller max-heller deleted the pandoc-3.2 branch June 25, 2024 17:57
@max-heller max-heller mentioned this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Links to chapters are broken when using Pandoc 3.2 or later
1 participant