-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Change img hrefs in markdown from file to vscode-file #136687
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the comment:
- Let's see if we can remove the other call to
_href
so that all images are handled in a consistent way - Make sure to add some test cases for this new logic. Here's the test file:
suite('MarkdownRenderer', () => {
@@ -100,6 +100,22 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende | |||
const withInnerHTML = new Promise<void>(c => signalInnerHTML = c); | |||
|
|||
const renderer = new marked.Renderer(); | |||
|
|||
const htmlParser = new DOMParser(); | |||
renderer.html = (rawHtml: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to break markdown text such as: text <b>bold</b>
as it gets rendered as:
<p>text <b></b>bold</p>
Instead, I think you should move this logic after the full md has been rendered but before sanitization:
let renderedMarkdown = marked.parse(value, markedOptions); |
Thanks! Should be in the next insiders build and is scheduled to go out with VS Code 1.63 |
In markdown renderer, hrefs of images in html are transformed from
file:
tovscode-file:
protocol.This PR fixes #136027