Repository navigation
fix(cli): render bold spans in docs markdown output - #7328
Closed
rezamuliawijaya wants to merge 2 commits into
Closed
rezamuliawijaya wants to merge 2 commits into
rezamuliawijaya wants to merge 2 commits into
Conversation
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.
3 tasks done
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
renderMarkdownnow renders**bold**spans in inline docs output instead of printing the markers literally.Why
hyperframes docs compositionsprints 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,renderMarkdownaround 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**throughc.boldonly in the prose around them.c.boldno-ops to plain text when the output is not a color-supported TTY (the existingwrapinui/colors.ts), so markers strip themselves off-TTY: one code path covers both cases in the issue's scope.formatInlineCodeis renamedformatInlinesince it now does more than code, andrenderMarkdownis exported so the rendering contract is testable directly.Test plan
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.tspasses 5/5