Skip to content

Add support for GFM admonition#307

Merged
qwandor merged 1 commit into
google:mainfrom
anonymaew:feat/gfm_admonition
May 28, 2026
Merged

Add support for GFM admonition#307
qwandor merged 1 commit into
google:mainfrom
anonymaew:feat/gfm_admonition

Conversation

@anonymaew

Copy link
Copy Markdown
Contributor

Summary

Add support for GitHub Flavored Markdown admonitions, which was added in v0.5. The "kind" should be left untouched while their body content is translated.

Changes

  • Enable ENABLE_GFM option so GFM alerts parse as BlockQuote(Some(BlockQuoteKind))1 events.
  • Grouping: The alert marker is treated as a Skip group; the body text is grouped as Translate groups (paragraphs inside the blockquote).
  • Translation: Translated body content is re-wrapped in a BlockQuote event to preserve the GFM structure. Untranslatable alerts pass through unchanged.

Result

Before After
Rendered rendered admonition before adjustment rendered admonition after adjustment

Footnotes

  1. https://docs.rs/pulldown-cmark/latest/pulldown_cmark/enum.BlockQuoteKind.html

- Enable `ENABLE_GFM` flag
- Treat the alert marker line as a skip element so it is not translated
- Add couple of unit tests for GFM admonition
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.43750% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.91%. Comparing base (9b96374) to head (4902643).
⚠️ Report is 45 commits behind head on main.

Files with missing lines Patch % Lines
i18n-helpers/src/lib.rs 98.14% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #307      +/-   ##
==========================================
- Coverage   86.05%   85.91%   -0.14%     
==========================================
  Files          17       17              
  Lines        3750     3429     -321     
  Branches     3750     3429     -321     
==========================================
- Hits         3227     2946     -281     
+ Misses        419      380      -39     
+ Partials      104      103       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@qwandor qwandor merged commit d6e9c2d into google:main May 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants