Skip to content

Add improved markdown front matter rendering#316147

Open
mjbvz wants to merge 1 commit into
mainfrom
dev/mjbvz/yeasty-armadillo
Open

Add improved markdown front matter rendering#316147
mjbvz wants to merge 1 commit into
mainfrom
dev/mjbvz/yeasty-armadillo

Conversation

@mjbvz
Copy link
Copy Markdown
Collaborator

@mjbvz mjbvz commented May 12, 2026

Fixes #316140

Let's try with table as the default initially but we can switch to hide is we prefer

Fixes #316140

Let's try with `table` as the default initially but we can switch to `hide` is we prefer
Copilot AI review requested due to automatic review settings May 12, 2026 23:33
@mjbvz mjbvz enabled auto-merge May 12, 2026 23:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and table rendering styles.
  • Adds markdown.preview.frontMatter setting (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';
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.

Add basic built-in markdown yaml frontmatter/preamble rendering support

3 participants