fix(docs): Broken Mermaid/KaTeX Rendering - #83
Merged
Conversation
ExDoc uses swup for client-side page transitions, so DOMContentLoaded and the KaTeX auto-render onload fire only on the initial hard load. After any in-docs navigation (sidebar link, internal link, HexDocs search) both Mermaid diagrams and $$..$$ math were left as raw source. Drive all rendering from ExDoc's window `exdoc:loaded` event, which fires on the initial load and after every swup content swap. Also fix the Mermaid selector: ExDoc emits <pre><code class="mermaid">, not <pre class="mermaid">. Closes HYP-10 (#82).
Test Results 4 files ± 0 227 suites ±0 3m 21s ⏱️ - 1m 4s Results for commit 5567e24. ± Comparison against base commit f6f88dd. This pull request removes 2 and adds 8 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
markovejnovic
marked this pull request as draft
July 13, 2026 22:42
Replace the hand-rolled DOM surgery with the snippet ExDoc's own README prescribes: two `exdoc:loaded` listeners, KaTeX via renderMathInElement, and Mermaid via mermaid.render() per <pre code.mermaid> block. Drops the unused \[ / \( delimiters (docs use only $ / $$), which removes the quad-backslash heredoc escaping, and loads mermaid with defer to match the reference. Same behavior, verified: KaTeX + Mermaid render on both hard load and swup nav.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
markovejnovic
marked this pull request as ready for review
August 3, 2026 03:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #82.