marknative-skill 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +143 -0
- package/package.json +28 -0
package/SKILL.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: marknative
|
|
3
|
+
description: Render Markdown files to paginated PNG/SVG images using the marknative CLI. Use this skill whenever asked to convert, render, or export Markdown to image formats.
|
|
4
|
+
metadata:
|
|
5
|
+
author: liyown
|
|
6
|
+
homepage: https://github.com/liyown/marknative
|
|
7
|
+
source: https://github.com/liyown/marknative/tree/main/packages/marknative-skill
|
|
8
|
+
user-invocable: false
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# marknative — Markdown to PNG/SVG renderer
|
|
12
|
+
|
|
13
|
+
`marknative` renders Markdown (CommonMark + GFM + LaTeX math) to paginated PNG or SVG pages without a browser. Runs entirely server-side via skia-canvas.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g marknative
|
|
19
|
+
# or run without installing:
|
|
20
|
+
npx marknative <file.md>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Basic usage
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Render file → page-01.png, page-02.png … next to the source
|
|
27
|
+
marknative README.md
|
|
28
|
+
|
|
29
|
+
# Write to a directory
|
|
30
|
+
marknative README.md -o out/
|
|
31
|
+
|
|
32
|
+
# Single output file
|
|
33
|
+
marknative README.md -o README.png
|
|
34
|
+
|
|
35
|
+
# SVG output
|
|
36
|
+
marknative README.md -f svg -o diagram.svg
|
|
37
|
+
|
|
38
|
+
# Pipe from stdin
|
|
39
|
+
cat notes.md | marknative -o preview.png
|
|
40
|
+
echo "# Hello" | marknative -f svg
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## All flags
|
|
44
|
+
|
|
45
|
+
| Flag | Short | Default | Description |
|
|
46
|
+
|------|-------|---------|-------------|
|
|
47
|
+
| `--format <fmt>` | `-f` | `png` | Output format: `png` or `svg` |
|
|
48
|
+
| `--output <path>` | `-o` | next to input | File path or directory. Trailing `/` forces directory |
|
|
49
|
+
| `--theme <name\|json>` | `-t` | `light` | Built-in theme name or JSON ThemeOverrides object |
|
|
50
|
+
| `--scale <n>` | `-s` | `2` | PNG pixel-density multiplier (1=fast, 2=default, 3=high-res) |
|
|
51
|
+
| `--single-page` | | `false` | Render all content into one image (no pagination) |
|
|
52
|
+
| `--code-theme <t>` | | auto | Shiki theme for code blocks |
|
|
53
|
+
| `--json` | | `false` | Print JSON manifest instead of file paths |
|
|
54
|
+
| `--help` | `-h` | | Show help |
|
|
55
|
+
|
|
56
|
+
**Built-in themes:** `light`, `dark`, `github`, `solarized`, `sepia`, `rose`, `nord`, `dracula`, `ocean`, `forest`
|
|
57
|
+
|
|
58
|
+
## JSON mode — for agents and scripts
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
marknative report.md --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"pages": [
|
|
67
|
+
{ "index": 1, "path": "/abs/path/report-01.png", "format": "png" },
|
|
68
|
+
{ "index": 2, "path": "/abs/path/report-02.png", "format": "png" }
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Extract paths:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
marknative report.md --json | jq -r '.pages[].path'
|
|
77
|
+
marknative report.md --json | jq -r '.pages[0].path'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Output path rules
|
|
81
|
+
|
|
82
|
+
- **No `--output`**: file placed next to input, or `cwd` when reading stdin
|
|
83
|
+
- **`--output` with extension, single page**: written to that exact path
|
|
84
|
+
- **`--output` without extension or trailing `/`**: directory mode — files named `<stem>-01.png`, `<stem>-02.png`, …
|
|
85
|
+
- **SVG single-page + no `--output`**: SVG written to stdout
|
|
86
|
+
|
|
87
|
+
## Performance
|
|
88
|
+
|
|
89
|
+
| `--scale` | Time/page | Use case |
|
|
90
|
+
|-----------|-----------|----------|
|
|
91
|
+
| `1` | ~29 ms | Quick preview |
|
|
92
|
+
| `2` | ~99 ms | Default (screen quality) |
|
|
93
|
+
| `3` | ~214 ms | High-res / print |
|
|
94
|
+
|
|
95
|
+
First render per process is slower (~1–3 s) due to skia-canvas, MathJax, and Shiki cold-start.
|
|
96
|
+
|
|
97
|
+
## Common patterns
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Quick preview
|
|
101
|
+
marknative doc.md -s 1 -o /tmp/preview.png
|
|
102
|
+
|
|
103
|
+
# Dark theme, single page
|
|
104
|
+
marknative slide.md -t dark --single-page -o slide.png
|
|
105
|
+
|
|
106
|
+
# High-res export
|
|
107
|
+
marknative doc.md -s 3 -o print/
|
|
108
|
+
|
|
109
|
+
# Custom JSON theme
|
|
110
|
+
marknative doc.md -t '{"colors":{"background":"#1e1e2e","text":"#cdd6f4"}}'
|
|
111
|
+
|
|
112
|
+
# SVG to PDF via pipe
|
|
113
|
+
marknative doc.md -f svg | rsvg-convert -o doc.pdf
|
|
114
|
+
|
|
115
|
+
# Render from stdin, JSON output
|
|
116
|
+
echo "# Title\n\nContent" | marknative --json -o /tmp/out/
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Math support
|
|
120
|
+
|
|
121
|
+
LaTeX via MathJax — inline `$E = mc^2$` and block `$$\sum_{i=1}^n i$$` both work.
|
|
122
|
+
|
|
123
|
+
## Programmatic API (Node.js / Bun)
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import { renderMarkdown } from 'marknative'
|
|
127
|
+
|
|
128
|
+
const pages = await renderMarkdown(markdownString, {
|
|
129
|
+
format: 'png',
|
|
130
|
+
scale: 2,
|
|
131
|
+
singlePage: false,
|
|
132
|
+
theme: 'dark',
|
|
133
|
+
codeHighlighting: { theme: 'github-dark' },
|
|
134
|
+
})
|
|
135
|
+
// pages: Array<{ format: 'png'|'svg', data: Buffer|string }>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Gotchas
|
|
139
|
+
|
|
140
|
+
- `--output` without extension → treated as **directory**, not a file
|
|
141
|
+
- Page numbers are zero-padded: `page-01.png`, not `page-1.png`
|
|
142
|
+
- SVG produces one file per page when `--output` is a directory
|
|
143
|
+
- Cold-start adds ~1–3 s to the very first render call per process
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "marknative-skill",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Claude Code skill for marknative — teaches agents how to render Markdown to PNG/SVG via CLI",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"files": [
|
|
7
|
+
"SKILL.md"
|
|
8
|
+
],
|
|
9
|
+
"keywords": [
|
|
10
|
+
"claude-code",
|
|
11
|
+
"claude",
|
|
12
|
+
"skill",
|
|
13
|
+
"marknative",
|
|
14
|
+
"markdown",
|
|
15
|
+
"render",
|
|
16
|
+
"png",
|
|
17
|
+
"svg"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/liyown/marknative.git",
|
|
22
|
+
"directory": "packages/marknative-skill"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/liyown/marknative#readme",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/liyown/marknative/issues"
|
|
27
|
+
}
|
|
28
|
+
}
|