-
Notifications
You must be signed in to change notification settings - Fork 28.7k
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
IconLabel markdown title debt #109914
IconLabel markdown title debt #109914
Conversation
@@ -301,3 +301,73 @@ function getInsaneOptions(options: { readonly isTrusted?: boolean }): InsaneOpti | |||
}; | |||
} | |||
|
|||
export function RenderMarkdownAsPlaintext(markdown: IMarkdownString) { |
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.
@mjbvz would you be able to review this function?
@bpasero I think I have addressed your feedback. |
@@ -301,3 +301,73 @@ function getInsaneOptions(options: { readonly isTrusted?: boolean }): InsaneOpti | |||
}; | |||
} | |||
|
|||
export function renderMarkdownAsPlaintext(markdown: IMarkdownString) { |
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.
So this function is meant to strip all the markup from the string? So # Header
would just be rendered as Header
?
Just want to check because we also have logic to escape markdown content:
vscode/src/vs/base/common/htmlContent.ts
Line 49 in 983ced6
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash |
# Header
as # Header
The change itself looks good. If renderMarkdownAsPlaintext
is the right approach, then just add a doc comment on it so its behavior is more clear
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.
Added documentation!
if (value.length > 100_000) { | ||
value = `${value.substr(0, 100_000)}…`; | ||
} | ||
return marked.parse(value, { renderer }); |
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.
Maybe just in case, the output should be passed through our html sanitizer (insane
) too
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.
Good point. Added a call to sanitizeRenderedMarkdown
.
Fixes #109231