Skip to content

fix(cli): render bold spans in docs markdown output - #7328

Closed
rezamuliawijaya wants to merge 2 commits into
heygen-com:mainfrom
rezamuliawijaya:fix/docs-bold-markers
Closed

rezamuliawijaya wants to merge 2 commits into
heygen-com:mainfrom
rezamuliawijaya:fix/docs-bold-markers

Conversation

@rezamuliawijaya

Copy link
Copy Markdown

What

renderMarkdown now renders **bold** spans in inline docs output instead of printing the markers literally.

Why

hyperframes docs compositions prints literal ** markers, e.g. **data-composition-variables** (source: packages/cli/src/docs/compositions.md). The terminal markdown renderer handled headings, bullets and backticks, but not bold (packages/cli/src/commands/docs.ts, renderMarkdown around lines 75-104).

Related work

Fixes #7277

How

Inline formatting splits on inline code spans first — markdown is literal inside backticks, so a ** there must stay one — and renders **bold** through c.bold only in the prose around them. c.bold no-ops to plain text when the output is not a color-supported TTY (the existing wrap in ui/colors.ts), so markers strip themselves off-TTY: one code path covers both cases in the issue's scope.

formatInlineCode is renamed formatInline since it now does more than code, and renderMarkdown is exported so the rendering contract is testable directly.

Test plan

  • Unit tests added/updated — packages/cli/src/commands/docs.test.ts: a rendered bold line contains no **; ** inside an inline code span stays literal. bun test packages/cli/src/commands/docs.test.ts passes 5/5
  • Pre-commit hooks pass (lint, format, tracked-artifacts, fallow, typecheck, commitlint)
  • Manual testing performed
  • Documentation updated (if applicable)

The render shim seeds getRandomValues only, so a composition calling
crypto.randomUUID() lints clean but still produces a different UUID on
every render and in every worker. Reproduce: compose a script that calls
crypto.randomUUID(), lint it — no non_deterministic_code finding appears
even though the value diverges across renders, the same symptom Math.random
and crypto.getRandomValues are flagged for.
hyperframes docs compositions printed literal ** markers because
renderMarkdown handled headings, bullets and backticks but not bold.
Reproduce: run `hyperframes docs compositions` — headings and accents
render, but **data-composition-variables** keeps its markers.

Inline formatting now splits on code spans first (markdown is literal
inside backticks, so ** there must stay one) and renders **bold** spans
through c.bold outside them. c.bold no-ops to plain text off a TTY, so
the markers strip themselves when output is not a terminal — the same
contract the other inline styling already follows.
@jrusso1020

Copy link
Copy Markdown
Collaborator

Thanks for contributing. I selected #7281 for this issue because it fixes and tests the original compositions topic. I also replayed that topic here: bold around a backtick span still leaves **data-composition-variables** in the output. Your literal-code preservation case is useful follow-up coverage. Closing this overlapping submission so the issue has one implementation to take through CI and merge: #7281. Your work remains available in this PR.

@jrusso1020 jrusso1020 closed this Nov 7, 2026
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.

hyperframes docs prints literal ** bold markers

2 participants