Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply VS Code's link renderer when rendering Markdown in preview panel #428

Merged
merged 2 commits into from
Aug 4, 2023

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Aug 4, 2023

VS Code has owned link renderer to add data-href attribute to every hyperlinks.
https://github.com/microsoft/vscode/blob/6a025483bda7044f1949ca9ee027969eb917de80/extensions/markdown-language-features/src/markdownEngine.ts#L330-L346

This was not important in not so long ago because the Electron frame could trap every page navigations. But in recent VS Code, it becomes important to trap <a> links because VS Code covers Web now.

We've updated to apply VS Code's link renderer when rendering Marp Markdown in the preview. <a href="https://example.com"> will render as <a href="https://example.com" data-href="https://example.com">, and VS Code built-in preview becomes able to trap links rendered by Marp.
https://github.com/microsoft/vscode/blob/6a025483bda7044f1949ca9ee027969eb917de80/extensions/markdown-language-features/preview-src/index.ts#L333-L348

Resolves marp-team/marp#461.

@yhatt yhatt merged commit 1a53c6d into main Aug 4, 2023
@yhatt yhatt deleted the apply-vscode-markdown-link-renderer branch August 4, 2023 18:43
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.

1 participant