You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support rendering raw HTML tags that appear in a MarkdownString #40607
In the screenshot, you can see the "p" and "br" tags are not rendered. I don't know if I need another extension to do this properly -- I searched the extensions and didn't see anything that seemed to fit.
I'm on a Mac, using Code version 1.19.1 and the intellisense extension version 2.1.0.
Reacted by Jens Hausdorf, Emran, James Blanksby, Gavin H, xVANKO95-zz, Alexander, Lars Hvam, Giulio Girardi, givinguphope and Marcus Vinicius Castelo Branco Martins
This is controlled by vscode - Markdown can contain HTML, but vscode chooses to escape all HTML. Imo simple HTML like p/b/ul/li etc should be whitelisted, there are npm modules that do this easily.
Yes, this is by-design. Our built-in markdown parser for intellisense documentation explicitly disables html tags so that we maintain more control over the presentation. Is html documentation widely used in the php community?
I've had one or two issues about supporting html in jsdocs, but haven't seen that pattern being widespread enough to justify pushing for this. And all the requests were to support html tags like <b> or <img> or <p> which already have markdown equivalents.
My questions and concerns:
How many extensions/use-cases would benefit from the change?
How painful are current workarounds?
Should there be multiple ways to express the same thing? (i.e. *text* and <i>text</i>) Which one would we encourage?
This would make the supported html subset part of the VS Code api. Do we want that?
Does this open us up too much to API creep, such as: why not whitelist <video> tags or style="color: red;" attributes?
How many extensions/use-cases would benefit from the change?
Can't comment on that, but there are thousands of PHP devs who would benefit directly from this.
How painful are current workarounds?
I see only two options:
Change the complete PHPStorm stubs repo to pure markdown. Not an option.
Use an HTML-to-markdown converter to optimistically convert it. Problem would be first detecting HTML in the first place and then not escaping existing markdown parts. Might actually be impossible. Will have a perf impact.
Should there be multiple ways to express the same thing? (i.e. text and text) Which one would we encourage?
This would make the supported html subset part of the VS Code api. Do we want that?
I don't think vscode needs to be concerned with that. The markdown spec allows HTML to be used, LSP uses markdown, so vscode should support markdown as full as possible.
Does this open us up too much to API creep, such as: why not whitelist
allowedTags: ['h3','h4','h5','h6','blockquote','p','a','ul','ol','nl','li','b','i','strong','em','strike','code','hr','br','div','table','thead','caption','tbody','tr','th','td','pre'],allowedAttributes: {a: ['href','name','target'],// We don't currently allow img itself by default, but this// would make sense if we didimg: ['src']},// Lots of these won't come up by default because we don't allow themselfClosing: ['img','br','hr','area','base','basefont','input','link','meta'],// URL schemes we permitallowedSchemes: ['http','https','ftp','mailto'],allowedSchemesByTag: {},allowProtocolRelative: true
With some slight modifications given this is running in an editor, not a browser (e.g. we clearly don't need target, meta etc)
changed the title [-]HTML inside hover/signature help markdown not rendering[/-][+]HTML inside hover/signature help markdown is not rendered[/+]on Feb 28, 2018
Please file a separate feature request against the LSP. I imagine the API would look similar but folks on the LSP side would have to confirm this feature makes sense for them
changed the title [-]HTML inside hover/signature help markdown is not rendered[/-][+]Support rendering raw HTML tags that appear in a MarkdownString[/+]on Oct 4, 2021
Activity
felixfbecker commentedon Dec 21, 2017
This is controlled by vscode - Markdown can contain HTML, but vscode chooses to escape all HTML. Imo simple HTML like
p/b/ul/lietc should be whitelisted, there are npm modules that do this easily.mjbvz commentedon Dec 21, 2017
Yes, this is by-design. Our built-in markdown parser for intellisense documentation explicitly disables html tags so that we maintain more control over the presentation. Is html documentation widely used in the php community?
felixfbecker commentedon Dec 21, 2017
I am using the same API stubs for the standard libraries that JetBrains PHPStorm is using, they use HTML everywhere unfortunately:
https://github.com/JetBrains/phpstorm-stubs/blob/43061d78f1980dedab671a30b419074b9e6d79f8/Core/Core.php#L76-L95
It would be really awesome if simple HTML tags could be whitelisted, e.g. with https://www.npmjs.com/package/sanitize-html
jrieken commentedon Jan 3, 2018
Fair, html to markdown to html sounds a little weird. One idea is to have
HtmlStringsimilar toMarkdownStringfelixfbecker commentedon Jan 3, 2018
Well I don't know generally in advance what content the string is, and since markdown can contain HTML per spec, I don't think
HtmlStringis neededmjbvz commentedon Jan 3, 2018
I've had one or two issues about supporting html in jsdocs, but haven't seen that pattern being widespread enough to justify pushing for this. And all the requests were to support html tags like
<b>or<img>or<p>which already have markdown equivalents.My questions and concerns:
*text*and<i>text</i>) Which one would we encourage?<video>tags orstyle="color: red;"attributes?felixfbecker commentedon Jan 3, 2018
Can't comment on that, but there are thousands of PHP devs who would benefit directly from this.
I see only two options:
I don't think vscode needs to be concerned with that. The markdown spec allows HTML to be used, LSP uses markdown, so vscode should support markdown as full as possible.
It should be possible to strike a reasonable balance here. sanitize-html has some reasonable defaults that can serve as an inspiration: https://www.npmjs.com/package/sanitize-html#what-are-the-default-options
With some slight modifications given this is running in an editor, not a browser (e.g. we clearly don't need
target,metaetc)[-]HTML inside intellisense popup not rendering[/-][+]HTML inside hover/signature help markdown not rendering[/+][-]HTML inside hover/signature help markdown not rendering[/-][+]HTML inside hover/signature help markdown is not rendered[/+]DanTup commentedon Mar 7, 2018
Hit this in Dart too:
Dart-Code/Dart-Code#638
Though our use is even more weird, because the API docs have this:
I'm not sure how to handle this. It basically comes with a requirement of some custom CSS for it to render correctly.
jrieken commentedon Mar 8, 2018
It is a lot, lot less likely that we will support custom, free form CSS there
28 remaining items
DanTup commentedon Sep 6, 2021
Matt Bierner (@mjbvz) would this also be supported via LSP?
mjbvz commentedon Sep 7, 2021
Please file a separate feature request against the LSP. I imagine the API would look similar but folks on the LSP side would have to confirm this feature makes sense for them
DanTup commentedon Sep 8, 2021
I've filed microsoft/language-server-protocol#1344 for LSP.
[-]HTML inside hover/signature help markdown is not rendered[/-][+]Support rendering raw HTML tags that appear in a MarkdownString[/+]