Add Markdown backend for Asciidoctor docs#2340
Add Markdown backend for Asciidoctor docs#2340leonard84 wants to merge 9 commits intospockframework:masterfrom
Conversation
Inline: quoted, anchor, image, footnote Code blocks: listing (with diagram support), literal Lists: unordered, ordered, description Table, admonition, image Container blocks: open, sidebar, example
- Decode numeric HTML entities (’ etc.) to Unicode characters - Decode named HTML entities (< > & etc.) to literal chars - Remove zero-width spaces from converted text - Fix double-nested markdown links from spockIssue/spockPull macros by returning plain URL when link text equals target - Fix publishDocs paths for multi-backend output directory structure - Fix asciidoctor task to use outputOptions block for backend config
- Remove markdown from main asciidoctor task, restore single html5 backend - Move diagram.use() from project-level asciidoctorj to the HTML task only - Extract shared config into configureAsciidoctor closure - Create asciidoctorMarkdown task without diagram module, preserving raw PlantUML/ditaa source as fenced code blocks - Fix convertLiteral to detect diagram style on literal blocks - Update publishDocs to depend on both tasks - Update docs-pr workflow to also run asciidoctorMarkdown
- Add listItemText() helper that recovers leading emphasis content lost by getText() when followed by + line continuation, by extracting it from getSource() and combining with getText() result - Add inline_break node handler (returns newline) - Add colist (callout list) handler (reuses ordered list converter) - Add quote block handler (renders as markdown blockquote with > prefix)
The HTML5 converter outputs node.text + <br> for inline_break nodes. Our converter was returning just "\n", losing the text content before the + line continuation. Now properly returns text + newline. Also collapse double newlines in list item text to prevent paragraph breaks within list items from + continuations.
- appendBlockTitle: extracts repeated block title rendering - appendContent: extracts repeated content appending - appendPrefixedContent: shared by admonition and quote (> prefix) - fencedCodeBlock: shared by convertListing and convertLiteral - appendListItemText: shared by ordered and unordered lists - appendListItemBlocks: shared nested block handling for list items - appendTableRow: extracts repeated table row rendering - convertContentBlock: replaces identical open/sidebar/example methods
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
👮 Files not reviewed due to content moderation or server errors (7)
📝 WalkthroughWalkthroughThis PR introduces Markdown documentation output support to the build system. A new Asciidoctor converter transforms AsciiDoc to Markdown format, registered via SPI. Gradle tasks and CI workflows are updated to generate Markdown alongside HTML documentation. Source linking logic conditionally skips table wrapping for Markdown output. Changes
Sequence Diagram(s)sequenceDiagram
participant Workflow as CI Workflow
participant Gradle as Gradle Build
participant Registry as Service Loader
participant Converter as MarkdownConverter
participant Asciidoctor as Asciidoctor Engine
Workflow->>Gradle: Execute asciidoctorMarkdown task
Gradle->>Registry: Initialize ConverterRegistry (SPI)
Registry->>Registry: Discover MarkdownConverterRegistry
Registry->>Converter: Register MarkdownConverter instance
Gradle->>Asciidoctor: Process AsciiDoc with backend=markdown
Asciidoctor->>Converter: convert(node, transform, opts)
Converter->>Converter: Dispatch by node type (doc, section, table, etc.)
Converter->>Converter: Entity decode & format as Markdown
Converter-->>Asciidoctor: Return Markdown string
Asciidoctor-->>Gradle: Generated Markdown docs
Gradle->>Gradle: Output to build/docs/asciidocMarkdown/
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ All tests passed ✅🏷️ Commit: 4058ea7 Learn more about TestLens at testlens.app. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2340 +/- ##
============================================
- Coverage 82.17% 82.16% -0.02%
+ Complexity 4826 4824 -2
============================================
Files 472 472
Lines 15040 15040
Branches 1908 1908
============================================
- Hits 12359 12357 -2
- Misses 1990 1991 +1
- Partials 691 692 +1 🚀 New features to boost your workflow:
|
Motivation
In the age of agentic AI, it is important that documentation be AI-accessible.
HTML is token-intensive, and stripping it down could cause conversion errors.
So this PR adds the capability to publish markdown alongside the HTML docs to make the documentation better accessible to AI Agents
Summary
MarkdownConverterthat renders the Spock docs as GitHub-flavored Markdown alongside the existing HTML output.publishDocs.inline_breakhandling (preserving leading text and+continuations), and skippingIncludedSourceLinkertable wrapping for the markdown backend.Summary by CodeRabbit
Release Notes
New Features
Chores