Skip to content

Add title and context menu for frontmatter in markdown preview#316308

Merged
mjbvz merged 1 commit into
mainfrom
dev/mjbvz/advanced-puma
May 13, 2026
Merged

Add title and context menu for frontmatter in markdown preview#316308
mjbvz merged 1 commit into
mainfrom
dev/mjbvz/advanced-puma

Conversation

@mjbvz
Copy link
Copy Markdown
Collaborator

@mjbvz mjbvz commented May 13, 2026

Follow up on #316140

Makes it easier to discover what the table is and hide it

Follow up on #316140

Makes it easier to discover what the table is and hide it
Copilot AI review requested due to automatic review settings May 13, 2026 20:43
@mjbvz mjbvz self-assigned this May 13, 2026
@mjbvz mjbvz enabled auto-merge May 13, 2026 20:43
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 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 title and data-vscode-context attributes 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.frontMatter setting, 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=\'{&quot;webviewSection&quot;:&quot;frontMatter&quot;}\'><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'
);
@mjbvz mjbvz merged commit a4c276d into main May 13, 2026
29 checks passed
@mjbvz mjbvz deleted the dev/mjbvz/advanced-puma branch May 13, 2026 21:11
@vs-code-engineering vs-code-engineering Bot added this to the 1.121.0 milestone 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
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.

3 participants