-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Some HTML-formatted text is completely removed from JSDoc Intellisense #110945
Comments
The |
Per the other issue I linked in the OP, they "support Markdown without HTML tag support". That's... a position to take, I guess -- if I had to write an IDE I'd certainly want to farm out Markdown parsing to one of the squillion existing libraries rather than write a partial implementation myself -- but at least they're clear about it. My concern is not with getting the tags supported, it's that stripping the tags should not also remove the content inside the tags. |
Copying description from related issue which was closed as duplicate.
Steps to Reproduce:
The doc comment for
Example Code/**
* <p>A basic interface with foo.</p>
*/
interface Foo {
foo: number;
}
let f: Foo; // Tooltip reads ""
/**
* A basic interface with bar.
*/
interface Bar {
bar: number;
}
let b: Bar; // Tooltip reads "A basic interface with bar." Does this issue occur when all extensions are disabled?: Yes |
Some findings which could be helpful:
The Marked Demo returns data as per CommonMark spec 0.29 4.6 HTML Blocks kind 6 for provided example. The example is also given in README under CLI usage https://github.com/markedjs/marked#usage |
Do you think the problem is here? I just searched for "strip" on a hunch, and found that any time |
As discussed in #31161, we strip html while rendering JSDocs. Here's the main place where this happens:
We need more community feedback before enabling a subset of safe html tags in our markdown strings |
My suggestion earlier was that instead of whitelisting tags to let through, you could remove all markup and include only the text node(s) as bare strings. Of course for elements that change plain text layout (block tags like headings, paragraph, lists, etc) the result would look pretty ugly, but for inline tags it would be an improvement over current behavior without possibility of security ramifications. A more thoughtful whitelisting would be more useful, but also more work. |
@thw0rted please use inclusive word like "allowlist" |
Duplicate of #40607 |
@mjbvz I don't actually think this is a duplicate of the linked issue. That issue wants (certain) HTML tags to be rendered into styled markup. It's a pretty big bite to take, has a lot of security implications etc, and it looks to me like the issue hasn't seen movement in 3+ years as a result. That's not what I'm asking for. Today, right now, the text content of unsupported tags disappears completely, resulting in a useless mess for a lot of third party libraries that I do not control. It's a bug with a simple, uncontroversial fix: stop eating the text. I'm worried that closing this as a duplicate of a difficult, controversial issue will result in users being stuck with the current, wrong behavior until someone has the time and energy to make a bunch of security and design decisions. |
Re-reading #40607, maybe @trivikr's issue is actually the same? There might actually be multiple separate but related disappearing-text issues. I didn't initially understand the older issue just from reading through it, and I think it might only be the
Re-reading #40607, the OP wants the second issue resolved -- and also wants So, there are really 3 related issues. |
Steps to Reproduce:
<pre>
or<code>
tags for formattingDoes this issue occur when all extensions are disabled?: Yes
See this Playground example, where
A basic interface with <code>x</code> and <pre>y</pre>
renders asA basic interface with and .
.I'm aware that per #31161 the official position is that HTML markup is "not supported", so by all means strip out tags, but completely removing text content is still a bug. We can't control how third-party code writes their documentation, so the language service needs to handle it in a sane way.
The text was updated successfully, but these errors were encountered: