Skip to content

Releases: liyown/marknative

v0.5.0 — Monorepo, CLI skill, docs overhaul

04 Apr 18:13

Choose a tag to compare

What's new

Monorepo restructure

The repository is now organized as a Bun workspace monorepo with three packages:

Package Description
packages/marknative Library + CLI (published to npm)
packages/marknative-docs VitePress documentation site
packages/marknative-skill Claude Code skill package

marknative-skill (new npm package)

A companion skill for Claude Code agents. Once installed via the Vercel skills system, agents automatically know how to use the marknative CLI — flags, JSON output mode, themes, and programmatic API.

npm: marknative-skill@0.1.0

Documentation overhaul

  • New CLI Reference guide — all flags, output path rules, JSON mode, performance table
  • Revised homepage with CLI Quick Start tab and updated feature list
  • Revised Getting Started — added CLI intro, math+code example, Next Steps table
  • Fixed --theme default value in CLI docs (lightdefault)
  • Sidebar reorganized into Introduction / Features / Advanced sections
  • Nav dropdown linking both npm packages

Test reliability

  • All smoke and perf tests now have explicit timeouts (30 s / 60 s) to work around bunfig.toml not loading in workspace mode
  • HTTP image fixtures replaced with locally generated PNGs — no more network dependency in tests

Packages

v0.4.0 — CLI

04 Apr 14:09

Choose a tag to compare

What's New

marknative CLI

Render Markdown to PNG/SVG from the command line or pipe — designed for use in scripts and AI agent workflows.

```bash

Render a file → page-01.png, page-02.png … next to the source

marknative report.md

Write into a directory

marknative report.md -o out/

Machine-readable output for agents / scripts

marknative report.md --json -o out/

→ {"pages":[{"index":1,"path":"/abs/out/report-01.png","format":"png"},…]}

Dark theme, scale 1 (fast preview)

cat notes.md | marknative -t dark -s 1 -o preview.png

SVG to stdout (pipe into another tool)

marknative slide.md -f svg | rsvg-convert -o slide.pdf
```

Flags: -f/--format, -t/--theme, -s/--scale, --single-page, --code-theme, --json, -h/--help

The CLI and library use the same renderMarkdown() under the hood — all options are identical.

Implementation notes

  • CLI bundle: 5.5 KB (imports marknative at runtime, no code duplication)
  • cli.d.ts is not generated or published (CLI has no public TypeScript API)

v0.3.1

04 Apr 13:48

Choose a tag to compare

Fix CI test timeouts in performance regression tests — no functional changes.

v0.3.0

04 Apr 13:42

Choose a tag to compare

What's New

Math Formula Rendering

Server-side LaTeX rendering via MathJax — no browser required.

  • Block formulas with $$...$$
  • Inline formulas with $...$, baseline-aligned with surrounding text
  • Works inside blockquotes, lists, and table cells
  • Formula colors follow the active theme automatically (dark themes get white formulas)
  • MathJax singleton initialised once per process (~180 ms cold start), SVGs cached per formula
const pages = await renderMarkdown(`
$$
\\hat{f}(\\xi) = \\int_{-\\infty}^{\\infty} f(x)\\,e^{-2\\pi ix\\xi}\\,dx
$$

The gradient $\\nabla f$ points in the direction of steepest ascent.
`)

PNG Resolution Control (scale)

New scale option controls pixel density for PNG output (default: 2).

scale Resolution Encode time
1 1080 × 1440 px ~29 ms
2 (default) 2160 × 2880 px ~99 ms
3 3240 × 4320 px ~214 ms
const pages = await renderMarkdown(md, { scale: 1 })  // fast preview
const pages = await renderMarkdown(md, { scale: 3 })  // print quality

Auto-Detect Shiki Code Theme

When codeHighlighting.theme is not set, the Shiki theme is now auto-selected from the page background luminance — dark marknative themes automatically use github-dark, light themes use github-light. No extra configuration needed.

// Both now produce readable code highlighting automatically
const light = await renderMarkdown(md)
const dark  = await renderMarkdown(md, { theme: 'dark' })

Performance

All numbers on Apple M-series (warm):

Document type PNG 2× (p50)
Plain text 115 ms
Code (3 languages) 101 ms
Math (4 block + 3 inline) 99 ms
Mixed (math + code) 97 ms
SVG output 5.6 ms

Run bun bench to reproduce on your machine.

Documentation

v0.2.0 — Theme System

03 Apr 07:42

Choose a tag to compare

What's New

Theme System

marknative now ships with a full theme customisation API and 10 built-in themes.

Built-in themes — pass a name string to renderMarkdown:

```ts
const pages = await renderMarkdown(markdown, { theme: 'dark' })
const pages = await renderMarkdown(markdown, { theme: 'nord' })
```

Available names: default · github · solarized · sepia · rose · dark · nord · dracula · ocean · forest

Partial overrides (merged onto defaultTheme):

```ts
const pages = await renderMarkdown(markdown, {
theme: {
colors: { background: '#1e1e2e', text: '#cdd6f4' },
page: { width: 800 },
},
})
```

Gradient backgrounds (linear and radial):

```ts
import { mergeTheme, defaultTheme } from 'marknative'

const theme = mergeTheme(defaultTheme, {
colors: {
background: '#0f0c29',
backgroundGradient: {
type: 'linear',
angle: 135,
stops: [
{ offset: 0, color: '#24243e' },
{ offset: 0.5, color: '#302b63' },
{ offset: 1, color: '#0f0c29' },
],
},
text: '#e8e0ff',
},
})
```

New Exports

Export Description
mergeTheme(base, overrides) Shallow-merge a partial override onto any base theme
getBuiltInTheme(name) Return a built-in theme by name
resolveTheme(theme?) Resolve undefined | string | ThemeOverridesTheme
isBuiltInThemeName(value) Type-guard for built-in theme name strings
BUILT_IN_THEME_NAMES Read-only tuple of all 10 theme names
BuiltInThemeName Union type of all valid theme name strings
Theme, ThemeOverrides, ThemeColors Core theme types
GradientFill, LinearGradientFill, RadialGradientFill, ColorStop Gradient types

Layout & Rendering Improvements

  • H3 and H4 distinct sizes — H3 (30 px), H4 (26 px) now render at different sizes instead of sharing the same style
  • Heading marginTop applied — space above mid-document headings is now correctly applied
  • Heading widow control — a heading that lands at the very bottom of a page (with fewer than 2 body lines remaining) is pushed to the next page
  • Distinct table header row — table headers now render with a filled background (tableHeaderBackground, defaulting to codeBackground)
  • Gradient page backgrounds — both linear and radial gradients are fully supported

Documentation

Full Changelog

v0.1.1...v0.2.0

v0.1.1

03 Apr 02:36

Choose a tag to compare

Bug Fixes

  • Image rendering — block-level images are now fetched via HTTP/HTTPS and drawn with aspect-ratio-preserving fit; unreachable URLs fall back to a placeholder box
  • Single-page mode — new singlePage: true option renders the entire document into one image; height adapts to content, capped at MAX_SINGLE_PAGE_HEIGHT (16 384 px)