@nova-lang/markdown
v0.1.0
Published
Nova Markdown utilities — convert HTML to/from Markdown, render, and process markdown content
Downloads
17
Maintainers
Readme
@nova-lang/markdown
Nova Markdown utilities — convert HTML to/from Markdown, render, and process markdown content.
Install
npm install @nova-lang/markdownUsage
@use "nova/markdown"Render / Convert
| Function | Description |
|----------|-------------|
| md-to-html(text) | Convert Markdown to HTML |
| md-from-html(html) | Convert HTML to Markdown |
| md-render-inline(text) | Render inline Markdown (no block wrapping) |
| md-render-file(path) | Read and render a Markdown file |
Table of Contents
| Function | Description |
|----------|-------------|
| md-toc(text) | Extract headings as a table of contents (JSON) |
| md-toc-html(text, maxLevel) | Generate TOC as HTML list |
| md-headings(text) | Extract heading texts as array |
Processing
| Function | Description |
|----------|-------------|
| md-strip(text) | Strip Markdown formatting, return plain text |
| md-summarize(text, maxLen) | Strip Markdown + truncate to maxLen chars |
| md-count-words(text) | Count words in markdown content |
| md-count-headings(text) | Count headings by level |
| md-extract-links(text) | Extract all links as [{text, url}] |
| md-extract-images(text) | Extract all images as [{alt, url}] |
| md-extract-code-blocks(text) | Extract code blocks as [{lang, code}] |
Frontmatter
| Function | Description |
|----------|-------------|
| md-parse-frontmatter(text) | Parse YAML frontmatter + body |
| md-has-frontmatter(text) | Check if text has frontmatter |
| md-frontmatter-keys(text) | Get frontmatter field names |
Transform
| Function | Description |
|----------|-------------|
| md-wrap-code(text, lang) | Wrap text in fenced code block |
| md-wrap-blockquote(text) | Wrap text as blockquote |
| md-escape(text) | Escape special Markdown characters |
License
MIT
