nuartz is a monorepo with two main packages:
packages/nuartz— the core library that handles markdown processingapps/web— the Next.js application that renders your digital garden
Processing pipeline
When a page is requested, nuartz processes your markdown through a unified pipeline defined in packages/nuartz/src/markdown.ts:
- Frontmatter extraction — gray-matter parses YAML frontmatter into structured data
- Remark (Markdown → Markdown AST) — The markdown is parsed with remark-parse into an mdast tree, then transformed by remark plugins:
remark-frontmatter— handles YAML/TOML blocksremark-gfm— GitHub Flavored Markdown (tables, strikethrough, etc.)remark-math— LaTeX math syntaxremark-breaks— soft line breaks- Custom nuartz plugins:
remarkWikilink,remarkCallout,remarkTag,remarkHighlight,remarkObsidianComment,remarkArrows
- Remark → Rehype — The markdown AST is converted to an HTML AST (hast) via remark-rehype
- Rehype (HTML AST → HTML AST) — Rehype plugins transform the HTML tree:
rehype-raw— pass-through raw HTMLrehype-pretty-code— syntax highlighting with dual themesrehype-slug+rehype-autolink-headings— heading anchorsrehype-katex— LaTeX renderingrehypeExtractToc— extracts table of contents from headings
- Stringify — rehype-stringify serializes the HTML AST to an HTML string
The pipeline returns a RenderResult containing the HTML, frontmatter, table of contents, outgoing links, and tags.
Key types
Defined in packages/nuartz/src/types.ts:
interface RenderResult {
html: string
frontmatter: Frontmatter
toc: TocEntry[]
links: string[] // outgoing wikilinks
tags: string[] // inline #tags
}
interface RenderOptions {
baseUrl?: string
resolveLink?: (target: string) => string
stripDrafts?: boolean
}The web application
apps/web is a standard Next.js App Router application:
app/layout.tsx— root layout with sidebar, theme provider, and global stylesapp/[...slug]/page.tsx— catch-all route that loads markdown fromcontent/, renders it through the nuartz pipeline, and displays the resultcontent/— your markdown files live here, organized by foldercomponents/— React components for the graph view, table of contents, navigation, etc.
File utilities
packages/nuartz/src/fs.ts provides helpers for reading and discovering content files, building the file graph for backlinks and the graph view.
Custom plugins
nuartz plugins live in packages/nuartz/src/plugins/ and are standard unified plugins — either remark (operating on mdast) or rehype (operating on hast). See creating-plugins for details on writing your own.