Skip to content

fix(course): Demote Markdown headings one level in lesson rendering#99

Merged
ebouchut merged 1 commit into
devfrom
fix/lesson-heading-levels
Jul 13, 2026
Merged

fix(course): Demote Markdown headings one level in lesson rendering#99
ebouchut merged 1 commit into
devfrom
fix/lesson-heading-levels

Conversation

@ebouchut

@ebouchut ebouchut commented Jul 13, 2026

Copy link
Copy Markdown
Owner

This PR fixes the lesson Markdown-to-HTML rendering to ensure there is a single <h1> to comply with RGAA 9.1.

The lesson page template provides the single h1 tag (the lesson title).
Without this fix, when an instructor adds a lesson with a level-one Markdown heading "# Heading", this would produce a second h1, and break the one-h1, no-skipped-level heading hierarchy that docs/rgaa.md commits to for RGAA 9.1.

A custom commonmark-java NodeRenderer now shifts every Markdown heading one HTML level down (h1 becomes h2, capped at h6) while keeping inline formatting inside the heading.

The jsoup sanitization and the content-addressed cache of ADR-0013 are unchanged, so existing lessons pick the corrected levels up on their next render with no migration.
The decision and its alternatives are recorded in ADR-0014.

The lesson page provides the single h1 (the lesson title), so an
instructor's "# Heading" produced a second h1 and broke the one-h1,
no-skipped-level heading hierarchy that docs/rgaa.md commits to for
RGAA 9.1.

A custom commonmark-java NodeRenderer now shifts every Markdown
heading one HTML level down (h1 becomes h2, capped at h6) while
keeping inline formatting inside the heading. The jsoup sanitization
and the content-addressed cache of ADR-0013 are unchanged, so existing
lessons pick the corrected levels up on their next render with no
migration. The decision and its alternatives are recorded in ADR-0014.
@ebouchut ebouchut self-assigned this Jul 13, 2026
@ebouchut ebouchut added bug Something isn't working backend accessibility Accessibility (RGAA, WCAG) course Course/Lesson documentation Improvements or additions to documentation labels Jul 13, 2026
@ebouchut ebouchut moved this to In Review in learn-dev-project Jul 13, 2026
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.53%. Comparing base (66e8e3c) to head (bc03ee2).

Additional details and impacted files
@@             Coverage Diff              @@
##                dev      #99      +/-   ##
============================================
+ Coverage     76.90%   77.53%   +0.62%     
  Complexity      141      141              
============================================
  Files            31       31              
  Lines           576      592      +16     
  Branches         36       37       +1     
============================================
+ Hits            443      459      +16     
  Misses          106      106              
  Partials         27       27              

☔ View full report in Codecov by Harness.
📢 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.

@ebouchut ebouchut added this to the v0.9 - Code Freeze milestone Jul 13, 2026
@ebouchut ebouchut merged commit 0c0c3f4 into dev Jul 13, 2026
7 checks passed
@ebouchut ebouchut deleted the fix/lesson-heading-levels branch July 13, 2026 20:25
@github-project-automation github-project-automation Bot moved this from In Review to Done in learn-dev-project Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Accessibility (RGAA, WCAG) backend bug Something isn't working course Course/Lesson documentation Improvements or additions to documentation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant