# Best way to migrate markdown to ghost?

**URL:** <https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349>\
**Category:** Using Ghost\
**Created:** [January 22, 2024, 11:20pm UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349 "2024-01-22T23:20:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rebirth784](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@rebirth784](https://forum.ghost.org/u/rebirth784)\
**Post date:** [January 22, 2024, 11:20pm UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/1 "2024-01-22T23:20:02Z")

</div>

Hi! I have a bunch of articles in markdown, and I’d like to import them to Ghost. Is there a good way to do it?

So far the closest I found is manually creating new articles on Ghost, switching to markdown via `/md` and copy-pasting the existing markdown articles. This is suboptimal however, since the markdown blocks in ghost are hard to edit when they are long - you double-click it and the cursor is always at the end of the article. Also, doing it one-by-one is too long if you have many articles.

Any tools to automate the process?

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [January 23, 2024, 3:00am UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/2 "2024-01-23T03:00:51Z")

</div>

There’s a set of migration tools in the @tryghost repo. It includes tools for markdown.

> **[GitHub - TryGhost/migrate](https://github.com/TryGhost/migrate)**
>
> Contribute to TryGhost/migrate development by creating an account on GitHub.

I did a markdown import (posts were coming from Hugo) recently. I converted markdown to HTML with showdown, parsed the resulting HTML for image src attributes, converted images to webp, uploaded modified images to Ghost, and rewrote the image srcs. Then fed the HTML into Ghost’s Admin API, along with extracted post attributes like title, tags, publication date, etc. That let Ghost do the HTML → Lexical conversion automatically, and fidelity was great, with one exception: Markdown tables. There were a few posts with markdown tables, and I didn’t see them in my initial sampling. So if you’ve got tables, watch out! :) (There are several possible workarounds, but I didn’t know we needed one until I was done, and my client just fixed them while checking the migration import.)

The flow above means that everything is native in the Ghost editor (ignoring tables), which makes editing later a breeze!

---

<div class="post-metadata">

**Author:** ![rebirth784](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@rebirth784](https://forum.ghost.org/u/rebirth784)\
**Post date:** [January 24, 2024, 1:41pm UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/3 "2024-01-24T13:41:30Z")

</div>

Did you use the repo you referenced? I can’t see any markdown mentions there…

---

<div class="post-metadata">

**Author:** ![CathyS](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathys/32/26697_2.png) [@CathyS](https://forum.ghost.org/u/CathyS)\
**Post date:** [January 24, 2024, 2:35pm UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/4 "2024-01-24T14:35:22Z")

</div>

Not sure if this is of use to you because you’re looking for a less cut and paste process, but I regularly do posts that are produced by a script that produces a plain text file with markdown codes in place, and I just cut and paste that into the editor.

I do not use the Markdown block.

The editor just knows what to do with the markdown, and then it’s an editable post in the normal way.

Note: I’m doing very simple markdown for headings and links only.

---

<div class="post-metadata">

**Author:** ![rebirth784](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@rebirth784](https://forum.ghost.org/u/rebirth784)\
**Post date:** [January 24, 2024, 2:53pm UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/5 "2024-01-24T14:53:20Z")

</div>

You mean, you just copy-paste from a markdown file into the editor? When I tried doing the same, my editor pasted everything as plain text - that is, a link didn’t get interpreted as a link but got pasted as text.

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [January 24, 2024, 2:57pm UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/6 "2024-01-24T14:57:44Z")

</div>

I didn’t (I was rolling my own because it was complicated in other ways), but take a look at the tooling for Jekyll - that’s taking in markdown and could be a good starting point.

> <https://github.com/TryGhost/migrate/tree/main/packages/mg-jekyll-export>
>
> //github.com/TryGhost/migrate/tree/main/packages/mg-jekyll-export

---

<div class="post-metadata">

**Author:** ![fatshark](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/fatshark/32/28558_2.png) [@fatshark](https://forum.ghost.org/u/fatshark)\
**Post date:** [January 24, 2024, 3:10pm UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/7 "2024-01-24T15:10:59Z")

</div>

[Obsidian](https://obsidian.md/) - a markdown note taking/writing app, available for all platforms - has a plugin that talks via the API to Ghost. It only appears to handle posts (not pages) but it works well. The stuff that ends up in Ghost is imported natively i.e. not as a markdown block. That may or not suit your needs.

In use you just complete your writing and then select the little Ghost symbol in the left margin and - bingo - the draft appears in Ghost.

I think you can change the frontmatter and make is published/featured etc … but I tweak it once uploaded.

It appears to handle the majority of markdown formatting.

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [January 24, 2024, 3:41pm UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/8 "2024-01-24T15:41:07Z")

</div>

> [@rebirth784](#):
>
> When I tried doing the same, my editor pasted everything as plain text

Which editor were you copy/pasting from? Unfortunately some editors (e.g. vscode) store markdown contents as plain text HTML when copying so our editor doesn’t see it as real plain text when pasting in order to treat it as markdown.

---

<div class="post-metadata">

**Author:** ![rebirth784](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@rebirth784](https://forum.ghost.org/u/rebirth784)\
**Post date:** [January 24, 2024, 3:44pm UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/9 "2024-01-24T15:44:50Z")

</div>

Right, I was copy-pasting from VS Code. I just tried doing the same from Obsidian, and the formatting was preserved. Thank you, good catch!

---

<div class="post-metadata">

**Author:** ![rebirth784](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@rebirth784](https://forum.ghost.org/u/rebirth784)\
**Post date:** [January 24, 2024, 3:49pm UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/10 "2024-01-24T15:49:01Z")

</div>

Thank you for the pointer - this is exactly what I was looking for! Life-saver!

---

<div class="post-metadata">

**Author:** ![Richard\_Careaga](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/richard_careaga/32/28367_2.png) [@Richard\_Careaga](https://forum.ghost.org/u/Richard_Careaga)\
**Post date:** [January 29, 2024, 9:57am UTC](https://forum.ghost.org/t/best-way-to-migrate-markdown-to-ghost/44349/11 "2024-01-29T09:57:14Z")

</div>

Doing a full scripted workflow is going to depend a lot on the consistency of the source postings and the selection of a lowest common denominator for the target postings. But you’ll find [pandoc—the Swiss Army Knife for text format conversion](https://pandoc.org) something that will be of great help even if you aren’t a CLI wizard.
