You can use some library. For example, in JavaScript you can use showdown.
// You can also use use it as CDN: https://unpkg.com/showdown/dist/showdown.min.js
// Example code in Javascript using showdown
var converter = new showdown.Converter(),
text = '# hello, markdown!',
html = converter.makeHtml(text);
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence