Skip to content

fix(build): restore CDS Shiki highlighting on the HANA publish path (#1657) - #1661

Merged
jung-thomas merged 1 commit into
mainfrom
worktree-fix-1657-cds-highlight
Aug 11, 2026
Merged

fix(build): restore CDS Shiki highlighting on the HANA publish path (#1657)#1661
jung-thomas merged 1 commit into
mainfrom
worktree-fix-1657-cds-highlight

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Fixes #1657 — CDS code blocks render with braces highlighted as illegal characters.

Root cause

Hugo's render-codeblock.html maps ```cds → the Chroma SQL lexer as a placeholder (Chroma ships no CDS lexer) and tags the wrapper data-lang=cds. The SQL lexer flags CDS braces as illegal → <span class=err>{ (the red braces in the issue screenshot). scripts/highlight-cds.ts (Shiki + the community cds.tmLanguage.json grammar) is supposed to replace those blocks with correct CDS highlighting in a post-build pass.

That pass runs in build:all (local + deploy.yml), so a local build is correct. But rebuild-content.yml — the canonical DEV/PROD content publish path — builds Hugo directly (/tmp/hugo --source hugo --minify), not build:all, and never runs build:highlight. It was dropped from this path pre-#591 (see the comment in content-drift-check.yml). So every content rebuild republished the Chroma-SQL fallback straight to HANA.

Evidence: live cap-status-transition-flows = 0 shiki, 15 class=err, 3 data-lang=cds blocks; the locally-built page (via build:all) = 298 shiki, 0 language-sql, blocks correct. Same failure class as the island-manifest / vendor / explore / joule steps previously retrofitted into this workflow.

Changes

  • rebuild-content.yml: add Highlight CDS code blocks (Shiki) step after the Hugo build, runs in all modes (slug-targeted included).
  • rebuild-content-qa.yml: same, pointed at hugo/public-qa (the QA publishDir).
  • scripts/highlight-cds.ts: accept --dir / HIGHLIGHT_DIR (default hugo/public) so the QA dir is supported; fail the run if the data-lang=cds marker is present but zero blocks matched — guards against silent markup drift regressing this again.

Verification

  • Ran the edited script against a fixture reproducing the exact live broken markup → 1 block replaced, exit 0, output is <pre class="shiki …"> with braces as normal punctuation (no class=err, no language-sql).
  • Verified the guard: marker present + 0 matched → exit 1 with a clear message.

Post-merge action required

This corrects the pipeline; it does not retroactively fix already-published HANA content. Once merged, trigger a full rebuild to republish with highlighting:

gh workflow run rebuild-content.yml --repo sap-tutorials/tutorials-ims --ref main -f mode=full

…1657)

Hugo maps ```cds to the Chroma SQL lexer as a placeholder (Chroma has no
CDS lexer), which flags CDS braces as illegal -> red <span class=err>{.
scripts/highlight-cds.ts (Shiki + community cds.tmLanguage.json) is meant to
replace those blocks, but rebuild-content.yml builds Hugo directly (not
build:all) and never ran it after it was dropped from the path pre-#591, so
every content rebuild republished the Chroma-SQL fallback to HANA.

- rebuild-content.yml: add 'Highlight CDS code blocks (Shiki)' step after the
  Hugo build, in all modes.
- rebuild-content-qa.yml: same, pointed at hugo/public-qa.
- highlight-cds.ts: accept --dir/HIGHLIGHT_DIR (default hugo/public) so the QA
  publishDir is supported; fail the run if the data-lang=cds marker is present
  but zero blocks matched (guards against silent markup drift).

Live PROD fix requires a full rebuild run once merged.
@jung-thomas
jung-thomas merged commit 5ff59ff into main Aug 11, 2026
3 checks passed
@jung-thomas
jung-thomas deleted the worktree-fix-1657-cds-highlight branch August 11, 2026 17:06
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.

Rendering of CDS code blocks look a bit broken

1 participant