Add TOC plugin for server-side table of contents generation#776
Open
rolfedh wants to merge 1 commit intoquarkiverse:mainfrom
Open
Add TOC plugin for server-side table of contents generation#776rolfedh wants to merge 1 commit intoquarkiverse:mainfrom
rolfedh wants to merge 1 commit intoquarkiverse:mainfrom
Conversation
Fixes quarkiverse#579 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
Thanks for the contribution ! I am busy this week, I'll have a careful look next week! |
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.
Summary
roq-plugin-tocmodule that generates a table of contents from page headings in Markdown and AsciiDoc contentquarkus-roqaggregate extension)How it works
The plugin parses rendered page HTML with JSoup, extracts headings (
h1–h6) that haveidattributes, and builds a nested hierarchy. It exposes two Qute template extensions onPage:{page.toc}— returns aList<TocEntry>withid,title,level, andchildrenproperties for custom rendering{page.tocHtml}— returns a pre-rendered<nav class="roq-toc">HTML block with nested<ul>lists and anchor linksBoth AsciiDoc (
div.sect*sections) and Markdown (h*[id]elements) heading formats are supported. All HTML output is XSS-escaped.This implementation generates static HTML on the server side, consistent with the issue request to "generate the TOC dom in the content." JavaScript-based scroll tracking or active-section highlighting would be a follow-up enhancement.
What's included
roq-plugin/toc/— new plugin module (deployment + runtime)LLM disclosure
This PR was developed with assistance from Claude Code (Claude Opus 4.6). All code was reviewed, tested, and verified by the author.
Test plan
mvn install -DskipTests— full project build succeedsmvn test -pl roq-plugin/toc/runtime— 16 unit tests passmvn verify— no cross-module regressions (pre-existingRoqCodestartTestfailures unrelated)blog/example: TOC renders correctly for both Markdown and AsciiDoc posts