You wrote the documentation in Markdown because Markdown is pleasant to write. The site it has to live on, though, is a folder of hand-built HTML pages: a header you copy from page to page, a navigation block you edit by hand, and no build step anywhere. The Markdown file cannot simply be dropped in. Something has to turn it into HTML first.
That something can be a converter you run one page at a time. This guide shows how to convert Markdown documentation into clean HTML fragments with the free Markdown to HTML Converter on Ovatly, what the conversion does to your markup on the way through, and when this route is the right one, because often it is not.
Contents
- Quick answer
- When a static site needs converted HTML (and when it does not)
- What happens during conversion: rendering, then sanitizing
- How to convert a documentation page, step by step
- Worked example: one small documentation page
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
To convert Markdown documentation for a static site: paste one finished Markdown page into the Markdown to HTML Converter, read the sanitized preview to confirm the page survived the trip, then copy the HTML or download it as an .html file and paste the fragment into your page template. The converter renders with the marked parser and then sanitizes the result with DOMPurify, so the code you paste in is safe code. Only take this route if your site has no generator; if it has one, hand it the Markdown file and skip this guide.
When a static site needs converted HTML (and when it does not)
Most static sites today are built by a generator, and most generators eat Markdown for breakfast. You drop a .md file into a folder, run the build, and the generator produces the finished page with your template wrapped around it. If that is your setup, converting Markdown to HTML by hand is wasted work: you would be doing the generator's job, badly, one page at a time.
The hand conversion route exists for the sites generators never touched. Plenty of small sites are still a set of HTML files edited directly: a project page on a plain web host, an internal documentation folder on a company server, a help section bolted onto an older site. There, the template already exists as HTML, and the only missing piece is each page's body in the same language, which is exactly the gap a converter fills. You keep writing documentation the way you like, in Markdown, and convert each page at the moment it joins the site.
There is a second, quieter case: a single page that has to live somewhere that accepts HTML only, such as a knowledge base field or a hosted page builder. Convert the one page, paste the fragment, move on.
What happens during conversion: rendering, then sanitizing
The converter does two distinct jobs, and it helps to know which is which when a page comes out different from what you expected.
First, rendering. The marked parser turns your Markdown into HTML following CommonMark-style rules: headings become heading tags, emphasis becomes emphasis tags, lists, links and code blocks become their HTML equivalents. A few GitHub-flavored features, such as tables and strikethrough, are supported as well, which matters for documentation, where tables are everywhere.
Second, sanitizing. The rendered HTML passes through DOMPurify first. Script tags are stripped. Event-handler attributes, the onclick style attributes that can hide inside pasted markup, are stripped. Links pointing at javascript: URLs are stripped. HTML comments are removed. Raw HTML that you wrote inside your Markdown is kept only where DOMPurify considers it safe. The point: the output is code you can paste into a public page without auditing every line yourself.
This is also why the converter differs from the Markdown Editor in the Developer tools section. The editor is a writing surface; the converter assumes the writing is done. Its whole job is the code itself: finished Markdown in, sanitized HTML out.
How to convert a documentation page, step by step
- Open the Markdown to HTML Converter and paste the full text of one documentation page. Convert one page at a time; the page boundary is your unit of checking.
- Read the sanitized preview. Check the things documentation depends on: headings in the right order, code blocks intact, tables still tables, links pointing where they pointed in the Markdown.
- If the source page contained raw HTML, compare carefully. Anything the sanitizer judged unsafe is gone, and it is better to discover that here than after publishing.
- Copy the sanitized HTML, or download it as an
.htmlfile if you would rather work from a file. - Paste the fragment into your page template where the body belongs, then open the finished page locally and read it once as a reader, not as the author.
Worked example: one small documentation page
Take the top of a tiny documentation page, a heading and one sentence with a bold term:
# Title
Some **bold** text.
The converter produces this:
<h1>Title</h1>
<p>Some <strong>bold</strong> text.</p>
That is the whole pattern, repeated down the page: each Markdown structure becomes the matching HTML structure. A real page is longer, with subheadings, lists, code samples and a table, but nothing new appears in kind, only in quantity. The preview is where you verify that quantity behaved, and where you spot any silent gaps where raw HTML used to be.
Limitations and honest tradeoffs
The sanitizing pass is a tradeoff, not a free lunch. If your documentation relies on embedded scripts, interactive demos or event handlers, those will not survive conversion, by design. The output is deliberately limited to safe, static markup. Documentation that needs live behavior must get it from the site around the fragment, not from inside it.
Raw HTML in your Markdown is only partly portable. Safe markup passes through; anything DOMPurify rejects disappears without a warning label on the specific line. The preview check in the steps above exists precisely because of this.
The workflow is also manual, and manual does not scale. Converting five pages is a coffee. Converting five hundred pages is a strong argument for adopting a generator instead. Be honest about which side of that line your site sits on.
The converter produces a fragment, not a finished page: your template still supplies the document head, navigation, styling and footer. If a converted page looks unstyled, the fragment is fine; it has not been placed inside the template yet.
Common mistakes
- Converting pages the generator would have handled. If your build already reads Markdown, converting by hand adds a stale copy of every page that can drift from the source. Check first.
- Skipping the preview. The sanitizer removes things quietly. The preview is the one moment where a missing table or stripped embed is cheap to notice.
- Pasting the fragment outside the template. A bare fragment has no styling, no navigation and no page title. It belongs inside your existing page shell.
- Expecting scripts to survive. They will not, and that is the point of the tool. Plan interactive elements at the site level instead.
- Converting the whole documentation set in one paste. Pages blur together and checking becomes impossible. One page in, one page checked, one page placed.
FAQs
Do I need to convert Markdown if my static site generator supports it? No. Most generators read Markdown files directly and build the HTML for you. Converting by hand is for hand-built sites, or for a page that has to be pasted into a template or a system that only accepts HTML.
What happens to raw HTML inside my Markdown documentation?
It passes through a sanitizer. Safe markup is kept, but script tags, event-handler attributes and javascript: URLs are stripped, and HTML comments are removed. Anything your page relied on that the sanitizer removes will not appear in the output.
Does the converter support tables and strikethrough? Yes, within limits. Rendering follows CommonMark-style rules through the marked parser, and a few GitHub-flavored features such as tables and strikethrough are supported as well.
Is my documentation uploaded anywhere?
No. The conversion runs entirely in your browser. You paste the Markdown, and the HTML is produced locally; you can copy it or download it as an .html file.
How is this different from the Markdown Editor in Developer tools? The Markdown Editor is a writing surface with an export. This converter's job is the code itself: you bring finished Markdown and take away sanitized HTML that is ready to paste into a page.
Conclusion
For a hand-built static site, the routine is small and repeatable: finish the page in Markdown, convert it with the Markdown to HTML Converter, check the sanitized preview, and paste the fragment into your template. For the bigger question of which format a given piece of writing should start in at all, see our companion guide on when to write in Markdown and when to write HTML directly. For more guides in this series, see our Website and Webmaster Tools guides, which pair each technique with the free tool that performs it.
References
- CommonMark, the specification the rendering rules follow: https://spec.commonmark.org/
- MDN Web Docs, on HTML elements and how browsers treat markup: https://developer.mozilla.org/en-US/docs/Web/HTML