Skip to content

Author Event History walkthrough content in MDX, consolidate demo components - #5275

Merged
Duncanma merged 2 commits into
mainfrom
duncan/add-md-support-walkthrough
Sep 9, 2026
Merged

Author Event History walkthrough content in MDX, consolidate demo components#5275
Duncanma merged 2 commits into
mainfrom
duncan/add-md-support-walkthrough

Conversation

@Duncanma

@Duncanma Duncanma commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Moves the Event History walkthrough content (docs/encyclopedia/event-history/*.mdx) from JS data files into the MDX pages themselves, and consolidates four separate demo components into one.

Why:

  1. The four interactive walkthrough demos (CodeToCommandsDemo, CommandsToEventsDemo, HistoryReplayDemo, NonDeterminismDemo) were registered strip-block in the MDX → Markdown pipeline, so the generated .md output (behind "Copy for LLM", llms.txt, and any crawler fetching <page>.md) had zero content for these sections — no code sample, no step narrative, nothing.
  2. The content lived in steps-*.js/languages/*.js data files, not in the .mdx pages, so a docs writer editing a page couldn't see or change it.

What changed:

  • Content is now authored directly in each .mdx page: a real fenced code block followed by one <WalkthroughStep> per step (with <WalkthroughCommand>/<WalkthroughEvent> for its Command/Event ledger entries).
  • The four demo components collapse into one <WalkthroughDemo ariaLabel="..." commandsLabel="..." eventsLabel="..."> — they only ever differed in those three values.
  • New transformer states in scripts/mdx-to-md.mjs + scripts/component-handlers/event-history-walkthrough.mjs render each step to a #### Step N heading with its Command/Event ledger in the generated Markdown, instead of stripping the block.
  • Deleted the now-dead steps-*.js/languages/*.js/numbered.js data files.
  • Content itself (steps, code samples, notes, per-SDK wording) is unchanged from what's live today — this only moves where it lives and fixes how it round-trips through the markdown pipeline.

Compare before/after:

SDK Page (before) Page (after) Markdown (before — currently empty walkthroughs) Markdown (after)
.NET live preview live preview
Go live preview live preview
Java live preview live preview
Python live preview live preview
TypeScript live preview live preview

Notes to reviewers

Opened as draft; happy to mark ready whenever.

Test plan:

  • node tests/run-all.mjs — 127/127 passed (12 new tests covering the transformer's new states)
  • yarn build — succeeds, no new transform warnings vs. main
  • Fetched the built .md output directly and confirmed all four walkthroughs now render real content (code + every step + ledger) instead of being empty
  • Browser-verified all four walkthroughs on the .NET page: stepping through highlights the right code lines, the Commands/Events ledger accumulates correctly, the History Replay demo's phase chips and "Event History at the time of the crash" divider render correctly, and the non-determinism demo's matched (✓) / mismatch (✗ + "Expected: ...") styling is correct
  • vale --config .vale-ci.ini docs/encyclopedia/event-history/ — 0 errors/warnings (3 pre-existing suggestion-level heading-case findings, on headings this PR doesn't touch)
  • Confirmed no new links were added to these pages (git diff has zero new [text](url) lines), so this doesn't change yarn check-links results

No content changes beyond relocation — every step's title, note, bullets, and Command/Event details are byte-for-byte what's live today (generated from the deleted JS files via a one-off script, not hand-retyped, to avoid transcription drift).

…ponents

The Event History walkthrough demos (docs/encyclopedia/event-history/*.mdx)
were registered strip-block in the MDX -> Markdown pipeline, so the LLM/crawler
markdown output (the .md files behind "Copy for LLM" and llms.txt) had zero
content for these sections: no code sample, no step narrative, nothing. The
underlying content also lived in JS data files (steps-*.js, languages/*.js),
not in the .mdx pages themselves, so a docs writer editing a page couldn't see
or change it.

Both are fixed by authoring the walkthrough content directly in each .mdx page:
a real fenced code block followed by one <WalkthroughStep> per step (with
<WalkthroughCommand>/<WalkthroughEvent> for its Command/Event ledger entries),
modeled on the existing SetupSteps/SetupStep pattern. The four previously
separate demo components (CodeToCommandsDemo, CommandsToEventsDemo,
HistoryReplayDemo, NonDeterminismDemo) collapse into one WalkthroughDemo,
parameterized by ariaLabel/commandsLabel/eventsLabel props, since they only
ever differed in those three values.

- scripts/mdx-to-md.mjs + scripts/component-handlers/event-history-walkthrough.mjs:
  new transformer states render each step to a `#### Step N` heading with its
  Command/Event ledger, instead of stripping the whole block.
- src/components/Demos/EventHistoryWalkthrough/: WalkthroughStep/
  WalkthroughCommand/WalkthroughEvent are declarative marker components (never
  rendered); parseWalkthroughChildren reads them off the MDX-authored children.
  Deleted the now-dead steps-*.js/languages/*.js data files.
- src/components/utils/extractElementText.js: fence-text extraction factored
  out of AnnotatedCode so both components share one implementation.

Content itself is unchanged from what already shipped (steps, code samples,
notes, per-SDK wording all preserved verbatim) -- this only moves where it
lives and fixes how it round-trips through the markdown pipeline.
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
temporal-documentation Ready Ready Preview Sep 9, 2026 4:51pm UTC

Request Review

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

@Duncanma
Duncanma marked this pull request as ready for review September 9, 2026 00:10
@Duncanma
Duncanma requested a review from a team as a code owner September 9, 2026 00:10
@Duncanma
Duncanma enabled auto-merge (squash) September 9, 2026 16:49
@Duncanma
Duncanma merged commit 5d8d874 into main Sep 9, 2026
15 checks passed
@Duncanma
Duncanma deleted the duncan/add-md-support-walkthrough branch September 9, 2026 16:51
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