Repository navigation
Render AsciiDoc admonitions as Markdown alerts - #2111
Open
ggrossetie wants to merge 2 commits into
Open
ggrossetie wants to merge 2 commits into
ggrossetie wants to merge 2 commits into
Conversation
Use a custom Asciidoctor HTML5 converter that only overrides convert_admonition to emit the markdown-alert markup GitHub already styles for Markdown alerts, instead of an unstyled table. The converter is passed through the :converter option rather than registered for the html5 backend, so other Asciidoctor conversions in the same process are unaffected. Closes github#2091 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Match comrak's rendering of Markdown alerts with a custom title (`> [!TIP] Custom title`): the block title replaces the default label in markdown-alert-title instead of being emitted as a separate, unstyled div. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Hi @joelhawksley @zkoppert 👋 This pull request addresses #2091 by rendering AsciiDoc admonitions with the same markup as Markdown alerts, so they pick up the The change is self-contained (a small Asciidoctor converter passed via The one thing I can't verify from this repo is whether the github.com sanitizer keeps the Thanks! |
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 #2091
AsciiDoc admonitions (
NOTE,TIP,IMPORTANT,WARNING,CAUTION) are currently rendered with Asciidoctor's default HTML5 markup: a bare<table>that github.com doesn't style. This PR renders them with the same markup as Markdown alerts, so they get themarkdown-alert*styles GitHub already ships.now renders as:
Changes
GitHub::Markup::AsciidoctorConverter, a subclass of Asciidoctor'sHtml5Converterthat overrides onlyconvert_admonition. It keeps the block's id and roles. One-line admonitions are wrapped in<p>; delimited (====) admonitions keep their child blocks..Title) as the alert title in place of the default label. This matches how comrak renders a Markdown alert with a custom title (> [!TIP] Custom title).:converteroption. It is not registered withregister_for 'html5', so other Asciidoctor conversions in the same process keep the default HTML5 output.asciidoctoris still only loaded on first use.README.admonitions.adocfixture covering all five types and the variants (paragraph style, delimited block, id, title, role). Add a unit test that checks the generated classes, since the test pipeline's sanitizer strips them.Line and branch coverage are still at 100%.
Notes for reviewers
markdown-alert,markdown-alert-<type>andmarkdown-alert-titleclasses ondivandpin markup output. I can't check that from this repo.🤖 Generated with Claude Code