Apply VS Code's link renderer when rendering Markdown in preview panel #428
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.
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.