Add improved markdown front matter rendering#316147
Open
mjbvz wants to merge 1 commit into
Open
Conversation
Fixes #316140 Let's try with `table` as the default initially but we can switch to `hide` is we prefer
Contributor
There was a problem hiding this comment.
Pull request overview
Adds built-in YAML front matter (“preamble”) support to the Markdown preview, replacing the previous dependency on markdown-it-front-matter with an in-repo markdown-it extension and exposing a new preview setting to control rendering style.
Changes:
- Introduces a new markdown-it block rule + renderer for YAML front matter with
hide,codeBlock, andtablerendering styles. - Adds
markdown.preview.frontMattersetting (default:table) plus CSS styling and localized configuration strings. - Adds engine tests covering rendering modes, invalid YAML handling, and non-front-matter cases.
Show a summary per file
| File | Description |
|---|---|
| extensions/markdown-language-features/src/util/dom.ts | Adds escapeHtml helper for safely rendering YAML-derived content. |
| extensions/markdown-language-features/src/typings/ref.d.ts | Removes leftover typing shim for markdown-it-front-matter. |
| extensions/markdown-language-features/src/test/engine.test.ts | Adds tests for front matter rendering behaviors. |
| extensions/markdown-language-features/src/preview/previewConfig.ts | Tracks new preview.frontMatter setting for preview configuration change detection. |
| extensions/markdown-language-features/src/markdownEngine.ts | Switches to the new built-in YAML preamble extension. |
| extensions/markdown-language-features/src/extensions/yamlPreamble/yamlPreamble.ts | Implements parsing + rendering of YAML front matter (hide/codeBlock/table + error rendering). |
| extensions/markdown-language-features/package.nls.json | Adds localized strings for the new setting and enum options. |
| extensions/markdown-language-features/package.json | Adds markdown.preview.frontMatter configuration and replaces dependency with yaml. |
| extensions/markdown-language-features/package-lock.json | Updates lockfile: removes markdown-it-front-matter, adds yaml. |
| extensions/markdown-language-features/media/markdown.css | Adds styles for front matter table/code block and error rendering. |
Copilot's findings
Files not reviewed (1)
- extensions/markdown-language-features/package-lock.json: Language not supported
- Files reviewed: 8/10 changed files
- Comments generated: 1
Comment on lines
+6
to
+10
| import type MarkdownIt from 'markdown-it'; | ||
| import type Token from 'markdown-it/lib/token.mjs'; | ||
| import * as vscode from 'vscode'; | ||
| import * as yaml from 'yaml'; | ||
| import { escapeHtml } from '../../util/dom'; |
DonJayamanne
approved these changes
May 13, 2026
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.
Fixes #316140
Let's try with
tableas the default initially but we can switch tohideis we prefer