Add title and context menu for frontmatter in markdown preview#316308
Merged
Conversation
Follow up on #316140 Makes it easier to discover what the table is and hide it
Contributor
There was a problem hiding this comment.
Pull request overview
Adds discoverability and a context menu entry for YAML front matter rendering in the built-in Markdown preview, making it easier for users to understand what the rendered table/codeblock represents and quickly jump to the visibility setting.
Changes:
- Adds
titleanddata-vscode-contextattributes to rendered front matter elements (table, code block, and error UI) so the preview can provide a tooltip and context menu targeting. - Introduces a new Markdown command that opens the
markdown.preview.frontMattersetting, and wires it into the Markdown preview webview context menu. - Updates the markdown engine test expectation for the front matter table HTML.
Show a summary per file
| File | Description |
|---|---|
| extensions/markdown-language-features/src/test/engine.test.ts | Updates expected HTML for front matter table rendering to include new attributes. |
| extensions/markdown-language-features/src/extensions/yamlPreamble/yamlPreamble.ts | Adds tooltip + webview context attributes to front matter render output (table/code/error). |
| extensions/markdown-language-features/src/commands/openFrontMatterSettings.ts | Adds a command to open the front matter visibility setting. |
| extensions/markdown-language-features/src/commands/index.ts | Registers the new command with the Markdown command manager. |
| extensions/markdown-language-features/package.nls.json | Adds localized title for the new command. |
| extensions/markdown-language-features/package.json | Contributes the command and adds it to the Markdown preview webview context menu. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 2
| } | ||
|
|
||
| function frontMatterAttributes(): string { | ||
| const label = escapeHtml(vscode.l10n.t('Frontmatter')); |
Comment on lines
92
to
96
| assert.strictEqual( | ||
| (await engine.render(input)).html, | ||
| '<table class="frontmatter"><tbody><tr><th>title</th><td>Hello</td></tr></tbody></table>\n' | ||
| '<table class="frontmatter" title="Frontmatter" data-vscode-context=\'{"webviewSection":"frontMatter"}\'><tbody><tr><th>title</th><td>Hello</td></tr></tbody></table>\n' | ||
| + '<h1 data-line="4" class="code-line" dir="auto" id="world">World</h1>\n' | ||
| ); |
roblourens
approved these changes
May 13, 2026
NikolaRHristov
pushed a commit
to CodeEditorLand/Editor
that referenced
this pull request
May 13, 2026
…-puma Add title and context menu for frontmatter in markdown preview
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.
Follow up on #316140
Makes it easier to discover what the table is and hide it