Moving a Markdown post into a CMS that only takes HTML
Many people draft in Markdown because it is quick to type and easy to read as plain text. The trouble starts when the draft has to go into a content management system, a newsletter tool or a help centre that wants HTML. Retyping the formatting by hand is slow and error-prone. Converting it takes a few seconds.
Here is a short release note as an example. It starts with "# Version 2.4", then the sentence "This release is about **speed**.", then "## What changed" and a list of two items: "- Exports are 3 times faster" and "- New [setup guide](https://example.com/setup)". Converted with Pasting into a page or CMS chosen, it becomes a few lines of HTML. The title is <h1 id="version-24">Version 2.4</h1>. Note the id: the full stop is dropped, as GitHub does. The sentence becomes a <p> with <strong>speed</strong> inside it, and the list becomes a <ul> with two <li> items, the second holding an <a href> link.
Paste that into the HTML view of your CMS and the post appears with its headings, bold text and link intact, in your site's own fonts. If the CMS strips id attributes, nothing breaks; only links to #version-24 stop jumping to the heading. If you choose A web page of its own instead, the same lines are wrapped in a full document with <title>Version 2.4</title>, ready to open in a browser or attach to an email.
One thing to watch is raw HTML. Markdown lets you mix tags in, so a line such as <details><summary>More</summary>Hidden text</details> passes straight through and works in most browsers. A <script> tag or an onclick attribute does not pass: the cleaning step removes them, because a converter that keeps scripts is a common way for unsafe code to reach a page.
This converter has limits. It produces plain HTML with no CSS, so tables have no borders until your site styles them. It does not convert footnotes, math, emoji shortcodes or GitHub alerts; they come out as ordinary text. Image paths are copied exactly as written, so a relative path such as images/chart.png only works if that file is in the same place on your site. And documents over one million characters are refused rather than freezing the tab.