Skip to content

Update documentation build: proper notes rendering on GitHub and ReadTheDocs#3506

Merged
arkid15r merged 3 commits into
vacanza:devfrom
KJhellico:upd-docs-build
Apr 6, 2026
Merged

Update documentation build: proper notes rendering on GitHub and ReadTheDocs#3506
arkid15r merged 3 commits into
vacanza:devfrom
KJhellico:upd-docs-build

Conversation

@KJhellico

Copy link
Copy Markdown
Collaborator

Proposed change

ProperDocs admonitions are not supported by the GitHub renderer:
image

GitHub Flavored Markdown notes are just ignored by ProperDocs:

image

instead of

image

So the best solution seems to be keeping all notes in GFM format and converting them to admonitions format when generating documentation in ProperDocs.

Type of change

  • New country/market holidays support (thank you!)
  • Supported country/market holidays update (calendar discrepancy fix, localization)
  • Existing code/documentation/test/process quality improvement (best practice, cleanup, refactoring, optimization)
  • Dependency update (version deprecation/pin/upgrade)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (a code change causing existing functionality to break)
  • New feature (new holidays functionality in general)

Checklist

@coderabbitai

coderabbitai Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Documentation

    • Standardized admonition/callout formatting across docs for consistent rendering and clearer subheadings; preserved original content.
    • Minor README wording/label tweaks for clearer subsection presentation.
  • New Features

    • Added automated docs conversion and publishing to produce multiple targets and perform configured link rewrites during conversion.

Walkthrough

Converts GitHub-style blockquote callouts in docs to ProperDocs/MkDocs admonition syntax and updates the docs-generation script to perform per-file replacements, convert GFM admonitions to MkDocs format, and generate multiple documentation targets (contributing.md, index.md, examples.md).

Changes

Cohort / File(s) Summary
Documentation files
CONTRIBUTING.md, README.md, docs/examples.md
Reformatted admonitions from GitHub blockquote form (> [!note], > [!tip]) to MkDocs/ProperDocs admonitions (!!! type "Title"). Minor heading/format tweaks and one inline URL replacement in docs/examples.md.
Docs generation script
scripts/docs/gen_index.py
Removed write_file() helper; added GFM_MKDOCS_MAPPING and FILES_REPLACE_MAPPING; added gfm_to_mkdocs(text: str) -> str; updated main flow to apply per-file replacements and emit contributing.md, index.md, and examples.md using mkdocs_gen_files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • arkid15r
  • PPsyrius
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main objective: updating documentation to render properly on both GitHub and ReadTheDocs by converting between GFM and ProperDocs formats.
Description check ✅ Passed The description explains the problem (incompatible admonition formats between platforms), the proposed solution (store as GFM, convert to ProperDocs on build), and relates directly to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Apr 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6ad53c4) to head (f345b67).
⚠️ Report is 4 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #3506   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          313       313           
  Lines        18659     18659           
  Branches      2383      2383           
=========================================
  Hits         18659     18659           

☔ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/docs/gen_index.py`:
- Around line 39-77: The gfm_to_mkdocs function is flagged for high cognitive
complexity; refactor by extracting subroutines: create
parse_admonition_header(lines, i) to detect and return (note_type, new_index)
using GFM_MKDOCS_MAPPING, parse_title_line(lines, i) to return (title,
new_index) when matching the bold title pattern, and
parse_admonition_body(lines, i) to collect and return (note_body_lines,
new_index) handling the ">" trimming logic, then have gfm_to_mkdocs orchestrate
these helpers and call a small assemble_admonition(note_type, title, note_body)
to produce the "!!! ..." and indented body lines; this splits the main while
loop into clear units (functions referenced: gfm_to_mkdocs,
parse_admonition_header, parse_title_line, parse_admonition_body,
assemble_admonition) and will lower cognitive complexity without changing
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f75f4813-2eb9-4193-be48-0fe68b6d7b85

📥 Commits

Reviewing files that changed from the base of the PR and between 7b265d7 and a7e7c25.

📒 Files selected for processing (4)
  • CONTRIBUTING.md
  • README.md
  • docs/examples.md
  • scripts/docs/gen_index.py

Comment thread scripts/docs/gen_index.py

@PPsyrius PPsyrius left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great execution IMO

I was originally thinking of https://github.com/PGijsbers/admonitions, but this PR avoids introducing new dependencies, so it's a win for me

Comment thread scripts/docs/gen_index.py
Comment thread scripts/docs/gen_index.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (2)
scripts/docs/gen_index.py (2)

61-64: 🧹 Nitpick | 🔵 Trivial

Combine nested if statements.

Per Ruff's SIM102 warning - these can be merged into a single condition with the walrus operator.

Suggested fix
         title = ""
-        if i < len(lines):
-            if match := re.match(r"^>\s*\*\*(.+?)\*\*", lines[i]):
-                title = f' "{match.group(1)}"'
-                i += 1
+        if i < len(lines) and (match := re.match(r"^>\s*\*\*(.+?)\*\*", lines[i])):
+            title = f' "{match.group(1)}"'
+            i += 1
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/docs/gen_index.py` around lines 61 - 64, Combine the nested ifs into
one condition using the walrus operator: replace the outer check "if i <
len(lines)" and the inner "if match := re.match(..., lines[i])" with a single
conditional that both verifies the index and assigns match (e.g., test that i <
len(lines) and bind match from re.match on lines[i] in the same expression);
update the block that sets title and increments i to use the bound match
variable (symbols to locate: i, lines, match, re.match, title).

45-81: 🧹 Nitpick | 🔵 Trivial

Cognitive complexity exceeds threshold.

SonarCloud flags this at 18 (limit 15). A past review suggested extracting helper functions for header/body parsing. Worth addressing if this script grows further.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/docs/gen_index.py` around lines 45 - 81, The gfm_to_mkdocs function
(in scripts/docs/gen_index.py) is too complex; refactor by extracting discrete
helpers to parse the admonition header and body: create a helper like
parse_admonition_header(lines, i) that detects the "> [!TYPE]" line, returns the
note_type and the next index, another helper parse_admonition_title(lines, i)
that returns the title (or empty) and next index by matching the bold title
pattern, and a parse_admonition_body(lines, i) that collects and returns the
unprefixed body lines and the next index; then simplify gfm_to_mkdocs to use
these helpers to produce the "!!! {note_type}{title}" and indented body lines,
reducing branching and cognitive complexity in gfm_to_mkdocs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@scripts/docs/gen_index.py`:
- Around line 61-64: Combine the nested ifs into one condition using the walrus
operator: replace the outer check "if i < len(lines)" and the inner "if match :=
re.match(..., lines[i])" with a single conditional that both verifies the index
and assigns match (e.g., test that i < len(lines) and bind match from re.match
on lines[i] in the same expression); update the block that sets title and
increments i to use the bound match variable (symbols to locate: i, lines,
match, re.match, title).
- Around line 45-81: The gfm_to_mkdocs function (in scripts/docs/gen_index.py)
is too complex; refactor by extracting discrete helpers to parse the admonition
header and body: create a helper like parse_admonition_header(lines, i) that
detects the "> [!TYPE]" line, returns the note_type and the next index, another
helper parse_admonition_title(lines, i) that returns the title (or empty) and
next index by matching the bold title pattern, and a
parse_admonition_body(lines, i) that collects and returns the unprefixed body
lines and the next index; then simplify gfm_to_mkdocs to use these helpers to
produce the "!!! {note_type}{title}" and indented body lines, reducing branching
and cognitive complexity in gfm_to_mkdocs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8259718c-fa37-4f99-885b-3414d74ee499

📥 Commits

Reviewing files that changed from the base of the PR and between a7e7c25 and e9caa87.

📒 Files selected for processing (2)
  • docs/examples.md
  • scripts/docs/gen_index.py

Comment thread docs/examples.md Outdated
Co-authored-by: Panpakorn Siripanich <19505219+PPsyrius@users.noreply.github.com>
Signed-off-by: ~Jhellico <KJhellico@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Apr 6, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/examples.md`:
- Around line 528-535: The GFM admonition for the Tip block uses the marker
"[!tip]" without an explicit title, which causes ProperDocs to drop the "Tip"
header; update the admonition by adding an explicit title marker (e.g., change
"[!tip]" to "[!tip] Tip") for the block that describes the Holidays object's
language/default_language behavior so the generated docs retain the "Tip"
heading.
- Around line 14-17: The generated GFM admonition "!!! tip" lacks an explicit
title so ProperDocs drops the "Tip" header; update the source admonition so the
callout includes an explicit title marker immediately after the "!!! tip" token
(i.e., add the explicit title string for the tip admonition) so the converted
output preserves the "Tip" title in ProperDocs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a7466855-0162-43b6-8562-5902ba3ec67b

📥 Commits

Reviewing files that changed from the base of the PR and between e9caa87 and f345b67.

📒 Files selected for processing (1)
  • docs/examples.md

Comment thread docs/examples.md
Comment thread docs/examples.md

@PPsyrius PPsyrius left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🗒️

@arkid15r arkid15r added this pull request to the merge queue Apr 6, 2026
Merged via the queue into vacanza:dev with commit 595f1cd Apr 6, 2026
32 checks passed
@KJhellico KJhellico deleted the upd-docs-build branch April 6, 2026 18:44
@KJhellico KJhellico mentioned this pull request Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants