showdownjs / showdown

A bidirectional Markdown to HTML to Markdown converter written in Javascript
http://www.showdownjs.com/
MIT License
14.19k stars 1.56k forks source link

HTML Img tag not rendering #960

Open msk4862 opened 1 year ago

msk4862 commented 1 year ago

Below line is not rendering with showdown:

<img src="" onerror={alert('hi')} />

I just wanted it to get rendered as it is as a string.

Screenshot 2022-11-08 at 9 06 04 PM

Code:

import xssfilter from 'showdown-xss-filter';

const MarkdownConverter = new Showdown.Converter({
  tables: true,
  simplifiedAutoLink: true,
  strikethrough: true,
  tasklists: true,
  extensions: [xssfilter],
});

export const previewHTML = markdown =>
  Promise.resolve(MarkdownConverter.makeHtml(markdown));