Markdown Editor & HTML Converter · Tutorial
How to move a blog post from HTML to Markdown
6 min readbeginnerUpdated
You are moving an old blog to a static site generator that uses Markdown files. This tutorial converts one saved post, including its head, styles and scripts, into clean Markdown, then shows what to check and tidy before you publish it on the new site.
What you need
- The Markdown Editor and its Import HTML button
- The post's HTML (save the page or view its source), or the sample from the Try it button
Steps
Get the post's HTML
Open the post in your browser and save the page as HTML, or copy the HTML of the article from your CMS. The sample is a full page about lunchbox ideas with a
<head>, a style block and a script.Import it into the editor
Press Import HTML, paste the HTML and press Convert to Markdown, or simply open the saved .html file with the file picker. The editor now holds Markdown, and the preview shows the post. The page title, styles and the analytics script have disappeared, because they are not part of the visible content.
Check the structure
The
<h1>is now a#heading, section titles are##headings and the steps are a numbered list. The link to the onigiri guide keeps its address, and the image becomeswith its alt text.Check the table
The prep-times table is now a Markdown pipe table, which most static site generators render as an HTML table again.
| Idea | Minutes | | --- | --- | | Onigiri | 15 | | Noodle salad | 20 |Fix links and images for the new site
Links like
/recipes/onigiripoint to paths on the old site. Update them to the new addresses, and copy images such as/images/bento.jpginto your new site's image folder.Save as a Markdown file
Add the front matter your site generator expects, such as a title and date, at the top, then press Download .md and rename the file after the post, for example
five-lunchbox-ideas.md. Most site generators use the file name as the page address.
Try it yourself
Opens the Markdown Editor & HTML Converter with this tutorial's sample loaded.
Common mistakes
- Copying the whole page with menus
- If you save the entire page, navigation, sidebars and footers come along as text and links. Copy only the article element where possible, or delete the extra parts afterwards.
- Removing the backslash in "1\."
## 1\. Onigiriis correct Markdown. Without the backslash some renderers would start a numbered list. The backslash is not shown on the page.- Expecting colours and fonts to survive
- Markdown has no styling. Apply the look through your new site's theme instead.
Next steps
Go back to the Markdown Editor & HTML Converter, or keep going with one of these:
FAQ
Can I convert many posts at once?
This tool converts one document at a time. Paste each post in turn, or script a bulk migration for hundreds of posts.
What about embedded videos?
Iframes are removed. Add the embed again using your site generator's shortcode or HTML.