Tapestry export
Export knowledge base content to PDF, Markdown, or HTML files saved under _data/exports/. Use when a user wants to save or share KB content as downloadable files. Supports exporting a single document file, a single feed entry, a single note, or the entire knowledge base.
install
source · Clone the upstream repo
git clone https://github.com/NatsuFox/Tapestry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/NatsuFox/Tapestry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/tapestry/export" ~/.claude/skills/natsufox-tapestry-export && rm -rf "$T"
manifest:
skills/tapestry/export/SKILL.mdsource content
Tapestry Export
Export knowledge base content to portable file formats: $ARGUMENTS
When to use this skill
Use this skill when:
- A user wants to export, save, download, or share knowledge base content
- The user asks for a PDF, Markdown, or HTML version of a document or the whole KB
- The user wants offline-readable files from the knowledge base
- The user wants to share a chapter or article outside the viewer
Arguments
The argument string may contain any combination of:
- format:
,pdf
,markdown
, orhtml
(default:all
)all - scope:
,file
,note
, orfeed
(default:kb
)kb - target: a path or partial path to the target artifact (required for
,file
,note
scopes)feed
Examples:
— export the entire knowledge base as PDF"pdf kb"
— export one document as HTML"html file _data/books/ai/chapter.md"
— export one note in all three formats"all note _data/notes/2025/03/my-note.md"
— export one feed entry as Markdown"markdown feed _data/feeds/2025/03/abc123.json"
Scope Resolution
| Scope | Source files | Notes |
|---|---|---|
| Single file under | Path provided by user |
| Single file under | Path provided by user |
| Single file under | Exports the field as Markdown |
| All files under recursively | Entire knowledge base |
Workflow
- Parse the argument to determine format, scope, and target.
- Change to the project root directory.
- Run the export script:
# Export entire KB as PDF python export/_scripts/export.py --format pdf --scope kb # Export entire KB in all formats python export/_scripts/export.py --format all --scope kb # Export a single document as HTML python export/_scripts/export.py --format html --scope file --target _data/books/topic/chapter/doc.md # Export a single note as Markdown python export/_scripts/export.py --format markdown --scope note --target _data/notes/2025/03/note.md # Export a single feed entry in all formats python export/_scripts/export.py --format all --scope feed --target _data/feeds/2025/03/abc123.json
- The script prints a JSON summary of all exported file paths to stdout.
- Report the output paths back to the user.
Output Location
All exported files are saved under
_data/exports/:
_data/exports/ markdown/ ← .md files html/ ← standalone .html files (self-contained, with embedded images) pdf/ ← .pdf files (requires playwright)
File names mirror the source path structure. For example:
_data/books/ai/chapter/doc.md → _data/exports/html/ai/chapter/doc.html
PDF Export Notes
PDF export uses Playwright (headless Chromium) to render the HTML to PDF. If Playwright is not installed, the script falls back to saving a self-printing HTML file (with
window.onload = window.print()) and will notify the user to open it in a browser
and use Print → Save as PDF.
To install Playwright:
pip install playwright && playwright install chromium
Rich Text Handling
- Math (KaTeX): All exported HTML files include KaTeX CDN scripts for math rendering.
- Images: Images are base64-encoded and embedded inline in HTML/PDF exports for full portability.
- Code blocks: Syntax-highlighted HTML is preserved from the knowledge base renderer.
- Tables: Standard HTML tables are preserved.
Resources
: Main export script.export/_scripts/export.py
: Providesdisplay/_scripts/publish_viewer.py
used for HTML rendering.render_markdown_document()
:_src/config.py
for resolving project and data paths.TapestryConfig