Merge Development into main - #215
Open
thamudi wants to merge 2 commits into
Open
Conversation
* feat: refactor table of contents to use processed headings in different langs and avoid re-parsing body * fix: add collapse/expand toc toggle
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.
This Merge request fixes and refactors how publication bodies are processed and how the table of contents (ToC) component is generated and rendered.
Centralized body processing in a new composable. Instead of parsing the HTML and extracting headings directly in the ToC component, the logic now lives in a composable that returns both the processed HTML (with ids added to the headings) and a structured list of headings. This makes sure the body is not parsed twice.
Fixed heading ids for Arabic and other non-Latin headings. Previously any non-Latin heading was stripped down to nothing, so all of them ended up sharing the same unusable id and their ToC links went nowhere. Ids now keep any valid letter, number, and hyphen, with a fallback to a unique id when the heading text can't produce a valid one.
Made the ToC collapsible. A ghost chevron button in the ToC header expands/collapses the list with a transition, and it stays expanded by default. This is a UX enhancement that is especially helpful on publications with a lot of headings (like this one), where the ToC would otherwise take up most of the sidebar (or push the body far down on mobile).