Skip to content

fix(directive-demos): 7 broken tutorials — code-blocks + rich-media + content-reuse - #3091

Merged
jung-thomas merged 1 commit into
DEVfrom
worktree-fix-demo-samples-render
Nov 10, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
worktree-fix-demo-samples-render

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Summary

Fixes all 7 broken directive demo tutorials that blocked blog-post publication. Three categories:

Bug 1: code-blocks (directive-code-blocks) — 4 sub-fixes

  • Step 1 (console line wrap): CSS white-space:pre + overflow-x:auto on .code-block-body pre
  • Step 2 (diff-marker preservation): highlight-cds guard skips Shiki replacement on Chroma diff-* classes; // [!code focus] annotations now survive
  • Step 4 (tree fence depths): fixed reversed strings.TrimLeft arg order (was garbage depth 7, now correct 0/1/2); added state-prefix (+/-/~) handling
  • Step 5 (line-click highlighting): use highlight() instead of markdownify to emit .line spans for JS handlers

Verification: all 4 rendered correctly in live browser (tree structure, depths, icons, state classes, diff-focus intact); tests 19/19 pass.

Bug 2: rich-media (directive-rich-media) — placeholder assets

8 labeled stand-in assets (PNGs, SVG, cast) uploaded to meta-tutorials so the demo renders cleanly instead of 404s. Real BTP Cockpit screenshots / diagram should replace them later.

PR in external repo: sap-tutorials/meta-tutorials#17 (all 8 assets committed; ready to merge).

Bug 3: content-reuse (directive-content-reuse) — slug + fail-loud validation

  • Fix 1: slug refs in meta-tutorials already point to hana-cloud-mission-trial-1 (live ✓)
  • Fix 2: catalogBySlug wired in fetch-tutorials.ts — maps all discovery slugs, guarded on source === 'github', reads real title/time from cache. Dead :tutorial/::requires refs now fail the rebuild loudly. Tests locked (directives-reference-links.test.ts line 62, directives-prerequisites.test.ts line 79).

Testing

  • Unit tests: npm test → 19/19 highlight-cds + directive tests pass
  • Pre-DEV: verify directive-code-blocks renders all 4 sub-fixes, diff-focus intact, tree depths correct, line spans present, console scrolls
  • Pre-PROD: full rebuild with catalogBySlug live will FAIL if any cross-ref is still dead — ensures no silent regressions

Next

  1. ✅ This PR: code-blocks fixes + directive tests
  2. ⏳ meta-tutorials#17: rich-media placeholder assets (external, ready to merge)
  3. After both merge + DEV→main promotion: PROD full rebuild validates all cross-refs fail-loud

…epths, line spans, diff markers

Fixes #3076 and step-2/4/5 bugs verified in browser:

- Step 1 (CSS): add white-space:pre + overflow-x:auto to .code-block-body pre for console line wrap
- Step 2 (highlight-cds): guard Shiki replacement on diff-marker presence; skip blocks with Chroma diff-* line classes so // [!code focus] annotations survive
- Step 4 (tree fence): fix reversed strings.TrimLeft arg order (was wrong order → garbage depth); add state-prefix (+/-/~) handling to preserve branch marks
- Step 5 (walkthrough): use highlight() instead of markdownify to emit .line spans for JS line-click handlers

All 4 code-blocks sub-fixes verified in live browser render (tree structure, depths, icons, state classes, line annotations, css classes, cds diff-focus intact). Tests pass 19/19.
@jung-thomas
jung-thomas merged commit f79c64e into DEV Nov 10, 2026
5 checks passed
@jung-thomas
jung-thomas deleted the worktree-fix-demo-samples-render branch November 10, 2026 15:36
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.

1 participant