← All packages

@lacspace/markdown

v1.0.2App & Utils Kit0 deps

A small, safe Markdown → HTML renderer — headings with anchor ids, nested & task lists, fenced code, blockquotes, GFM tables, images and links. HTML in the source is escaped. Includes extractHeadings() for a table of contents. Zero-dependency, isomorphic.

npm i @lacspace/markdown

Usage

markdown.ts
import { markdownToHtml, extractHeadings, slugify } from "@lacspace/markdown";

const html = markdownToHtml(`
# Getting started

Some **bold** text, a [link](https://lacspace.com) and \`inline code\`.

- a list
  - that nests
- [x] and task items

| Feature | Status |
| ------- | :----: |
| Tables  |   ✅   |

\`\`\`ts
const x = 1;
\`\`\`
`);

Exports 3

extractHeadingsmarkdownToHtmlslugify

Keywords

markdownmdmarkdown-to-htmlmarked-alternativegfmtable-of-contents

More in App & Utils Kit