Back to articles

NOTE / Markdown

Keeping structure when importing Markdown

Import drafts while preserving headings, lists, and code blocks.

Implementation

Extract a leading H1 and store the body as Markdown so the source stays editable.

Try it

Import a file with a title, a list, and a code block, then verify that the preview links to each heading.

JavaScript
const html = markdown.render(source);
Related project Markdown Workbench