Nuemark is Nue’s Markdown-based authoring format. Beyond the standard Markdown you already know, it adds automatic sections, custom tags, responsive images, and structured data access — while keeping content files free from JavaScript. The package exposes a rendering function, a document parser, and a set of lower-level utilities for building custom pipelines.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nuejs/nue/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Exports
nuemark(content, opts?)
Renders a Nuemark string directly to an HTML string. This is the simplest entry point — pass content in, get HTML out.
The full Nuemark source text including optional YAML front-matter, Markdown, and Nuemark tag blocks.
Rendering options forwarded to the block renderer.
string.
Example:
parseNuemark(content)
Parses a Nuemark string into a document object without rendering. Use this when you need to inspect headings, extract front-matter, or render with custom options later.
The raw Nuemark source string, including optional YAML front-matter delimited by
---.Key–value pairs parsed from the YAML front-matter block. If the document has an
# H1 heading and no explicit title in front-matter, meta.title is set automatically. If the first paragraph exists and meta.description is absent, it is set from that paragraph.The flat list of parsed block nodes (headings, paragraphs, code blocks, tag invocations, etc.) before sectionization.
A computed property that filters
blocks to heading nodes and returns objects with { id, level, text, attr }. The id is derived from the heading text when not set explicitly.All fenced code-block nodes in the document. Each item exposes
name (language), code (raw source), attr, and data.Render the parsed document to an HTML string. Accepts the same
opts object as nuemark(). Calling render multiple times with different options is safe — the document object is not mutated.elem(tag, attrs?, content?)
A low-level HTML element builder. Returns a serialized HTML string for the given tag, optional attribute object, and inner content.
The HTML tag name, e.g.
'p', 'div', 'figure'.When an object, each key–value pair is serialized as an HTML attribute. Falsy values are omitted. When a string is passed as the second argument (no
attrs object), it is treated as the content.Inner HTML content to place between the opening and closing tags.
string.
Examples:
renderInline(str, opts?)
Renders a single line of Nuemark inline markup — bold, italic, code spans, links, images, and inline tag invocations — to an HTML string.
A single-line string of Nuemark inline content.
Same options accepted by
nuemark(), particularly data and tags. Used when the inline string contains { expr } variables or custom inline tags.string with all inline markup expanded.
Examples:
parseSize(data)
Extracts width and height values from a data object that may use a compact size shorthand (e.g. "800x600"). Used internally by the [image] tag renderer; export it when you build custom image tags.
An object that may contain any of:
size (e.g. "800x600" or "400"), width, height.{ width, height }:
size: "800x600"→{ width: "800", height: "600" }size: "400"→{ width: "400", height: "400" }(square)width: 640, height: 480→{ width: 640, height: 480 }(passthrough)
renderIcon(name, symbol, icon_dir?)
Renders an SVG icon either by reading an .svg file from disk or by generating an inline <use> reference to a sprite.
The filename (without extension) of an
.svg file to inline. Takes precedence over symbol when provided.A sprite symbol ID. Generates
<svg class="icon icon-{symbol}"><use href="#{symbol}"/></svg>.The file-system directory to look up icon files in when
name is set.string, or '' if both name and symbol are falsy.
Examples:
Document structure
parseNuemark returns a document whose internal blocks map to these types:
| Block type | Detected by | Notes |
|---|---|---|
| Heading | block.level (1–6) | text, attr, and computed id |
| Paragraph | block.is_content | content is an array of line strings |
| Code block | block.is_code | name = language, code = raw source |
| Tag invocation | block.is_tag | name, attr, data, blocks |
| Table | block.is_table | rows, head, foot, caption |
| List | block.is_list | items (array of block arrays), numbered |
| Blockquote | block.is_quote | blocks contains inner blocks |
| Thematic break | block.is_break | Renders as <hr> |
| Section separator | block.is_separator | --- lines that split sections |
Sections
Documents are automatically split into sections at--- separators or at heading boundaries. The render({ sections: true }) option wraps each section in a <section> element:
Front-matter
YAML front-matter is stripped before parsing and returned asdoc.meta: