feat(client): render YAML frontmatter in markdown preview (full/diff)#442
Draft
woo-cie wants to merge 6 commits into
Draft
feat(client): render YAML frontmatter in markdown preview (full/diff)#442woo-cie wants to merge 6 commits into
woo-cie wants to merge 6 commits into
Conversation
Add before/after markdown pairs covering scalar, array, single-level nested, and deep-nested YAML frontmatter changes for the frontmatter preview feature.
…#441) Add remark-frontmatter and js-yaml dependencies for the upcoming frontmatter preview feature, plus a standalone extractFrontmatter helper that regex-splits a leading YAML block and safely parses it. remark-frontmatter is unused for now (wired into the unified pipeline in a later task); ignored in knip.json until then.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…pg#441) Restructures MarkdownDiffViewer's preview fetch logic to retrieve both base and target blobs in parallel via Promise.allSettled, laying the groundwork for diff-preview frontmatter rendering while keeping MarkdownFullPreview and MarkdownDiffPreview behavior unchanged.
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.
Closes #441
Summary
Render YAML frontmatter as a structured key/value table in both
full-preview(snapshot) anddiff-preview(key-level diff) tabs of the markdown preview.Plan (attack in progress)
Parser:
remark-frontmatter(official unified plugin) +js-yamldirect call, encapsulated behindextractFrontmatter(text)pure helper.remark-parse-frontmatter.load()default (no!!js/function).Rendering:
FrontmatterTablewithmode: 'snapshot' | 'diff'andlabel?props.bg-diff-addition-bgetc.).Diff computation:
computeFrontmatterDiff(old, new)pure function.JSON.stringify(recursive key sort) to avoid false positives from key-order changes.Two-side fetch (diff-preview only,
case α):Promise.allSettledon the existing/api/blob/${path}?ref=${ref}API.file.status: added / deleted / renamed / modified handled explicitly.---(perf).full-preview: unchanged (snapshot only). Preserves the "read vs. diff" semantic separation.
Tasks (10)
docs/syntax-sample/(4 nesting patterns + before/after diff pair)remark-frontmatter+js-yamldeps +extractFrontmatterhelperFrontmatterTablesnapshot modeMarkdownDiffViewer)computeFrontmatterDiffpure function (canonical stringify)FrontmatterTablediff modepnpm why js-yaml, bundle size, 20 visual patternsTest plan
full-previewrenders the frontmatter table before the body when presentdiff-previewrenders diff-highlighted table with additions / deletions / modifications for the 4file.statusvariantscomputeFrontmatterDiffunit tests: key-order-change (no false positive), type change, nested, array, nullpnpm build,pnpm typecheck, existing tests passpnpm why js-yamlresolves to a single v4.x version