Saturday, June 7, 2025

How to display markdown text as HTML in Blogger.com?

1. Add marked.js to your blogger.com Theme header and add the script to the bottom of the body. * Note: Please go to https://marked.js.org/ to confirm the latest CDN link.
<script src='https://cdn.jsdelivr.net/npm/marked/marked.min.js'></script>
<script>
  document.querySelectorAll('md').forEach(el => {
    const markdownText = el.textContent;
    const html = marked.parse(markdownText);
    el.innerHTML = html;
  });
</script>
2. Then, in your Blogger.com editor, you can start to write markdown text like below.
<md>## This is a testing.</md>
3. The markdown result will be like below. ## This is a testing.

No comments:

Post a Comment