Skip to content

Commit

Permalink
Fix <a> without href stripping html (microsoft#152230)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz authored Jun 15, 2022
1 parent 98ad4c1 commit 57037a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vs/base/browser/markdownRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende
|| /^command:(\/\/\/)?_workbench\.downloadResource/i.test(href)
) {
// drop the link
a.replaceWith(a.textContent ?? '');
a.replaceWith(...a.childNodes);
} else {
let resolvedHref = _href(href, false);
if (markdown.baseUri) {
Expand Down
8 changes: 8 additions & 0 deletions src/vs/base/test/browser/markdownRenderer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ suite('MarkdownRenderer', () => {
</tbody></table>
`);
});

test('render icon in <a> without href (#152170)', () => {
const mds = new MarkdownString(undefined, { supportThemeIcons: true, supportHtml: true });
mds.appendMarkdown(`<a>$(sync)</a>`);

const result: HTMLElement = renderMarkdown(mds).element;
assert.strictEqual(result.innerHTML, `<p><span class="codicon codicon-sync"></span></p>`);
});
});

suite('ThemeIcons Support Off', () => {
Expand Down

0 comments on commit 57037a7

Please sign in to comment.