cosmiciron/vmprint/documents

Claude Code and agent skill by cosmiciron/vmprint

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Practitioner's guide for constructing documents with the VMPrint JSON AST 1.1. Use when creating or editing vmprint JSON documents. Covers page geometry, element types (story, table, zone-map, strip, image), floats, drop caps, column spans, headers/footers with strip layouts, multilingual text, pagination control, and the document scripting system.

Install

npx vskill@latest install cosmiciron/vmprint/documents

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as cosmiciron/vmprint/documents.

VMPrint AST Layout Skill

A practitioner's guide to constructing sophisticated layouts with the VMPrint JSON AST version 1.1. Use this alongside the regression fixtures in engine/tests/fixtures/regression/ and engine/tests/fixtures/scripting/ (working examples for every feature).

Schema authority: The interfaces embedded in this skill (§ "Exact … interface" blocks) are the canonical contracts for allowed keys. Do not guess at key names — if a key is not listed in one of those interface blocks, it does not exist. The pitfalls section documents keys that have been hallucinated in the past.
AST 1.1 breaking changes from 1.0: placement replaces properties.layout; image, dropCap, columnSpan, table are now top-level element keys instead of nested inside properties.

1. Root Structure

Every document is a single JSON object:

json
{
"documentVersion": "1.1",
"layout": { ... },
"fonts": { ... },
"styles": { "myType": { ... } },
"elements": [ ... ],
"header": { ... },
"footer": { ... }
}
  • documentVersion — always "1.1"
  • layout — page geometry and typographic defaults
  • fonts — optional; only needed for custom font files
  • styles — maps element type strings to base styles; anything not here defaults to layout values
  • elements — the content tree
  • header / footer — optional running regions

Optional scripting keys at root level: methods, scriptVars, onBeforeLayout, onAfterSettle.


2. Page Geometry

json
"layout": {
"pageSize": { "width": 720, "height": 405 },
"orientation": "landscape",
"margins": { "top": 34, "right": 50, "bottom": 34, "left": 50 },
"pageTemplates": [
{
"pageIndex": 1,
"pageSize": { "width": 280, "height": 420 },
"margins": { "top": 34, "right": 22, "bottom": 34, "left": 22 }
}
],
"fontFamily": "Arimo",
"fontSize": 10,
"lineHeight": 1.35,
"pageBackground": "#fdf6e3"
}

pageSize accepts "A4", "LETTER", or { "width": N, "height": N } in points. Standard sizes:

NamePoints
A4 portrait595 × 842
LETTER portrait612 × 792
16:9 landscape720 × 405

pageTemplates can override pageSize, orientation, and/or margins for matching pages. pageIndex is zero-based; selectors such as "first", "odd", "even", and "all" are also supported. The engine resolves the active page geometry before measuring that page, so odd-sized pages change real flow space and render as matching PDF media boxes.

Content area math (critical for fitting content on page):

contentWidth = pageWidth - marginLeft - marginRight
contentHeight = pageHeight - marginTop - marginBottom

For a 720 × 405 page with margins {top:34, right:50, bottom:34, left:50}:

  • contentWidth = 720 - 50 - 50 = 620 pt
  • contentHeight = 405 - 34 - 34 = 337 pt

In a 3-column story with gutter 12:

  • columnWidth = (620 - 12 × 2) / 3 = 198.67 pt

Line height in points = fontSize × lineHeight. For 10pt / 1.35: 13.5 pt per line.

Lines per column = floor(contentHeight / lineHeightPt).


3. Fonts

Built-in font families available without registration: Arimo, Tinos, Cousine, Caladea, Carlito, Noto Sans JP (CJK), Noto Sans Arabic, Noto Sans Thai, Noto Sans Devanagari.

Reference a built-in family by name in fontFamily; no fonts block needed:

json
"fonts": { "regular": "Arimo" }

For custom font files, register by role:

json
"fonts": {
"regular": "path/to/font.ttf",
"bold": "path/to/font-bold.ttf",
"italic": "path/to/font-italic.ttf",
"bolditalic": "path/to/font-bolditalic.ttf"
}

The engine maps fontWeight/fontStyle to these slots at render time. For named non-system fonts in inline spans use fontFamily on properties.style of a "text" child.

Standard PDF 1.4 built-in fonts (zero-embed, Latin-only docs via StandardFontManager): Helvetica, Times New Roman, Courier — common aliases like Arial → Helvetica resolve automatically.


4. Styles Table

Every type string is a key into styles. Style resolution: styles[element.type] (base) merged with properties.style (override).

json
"styles": {
"heading": {
"fontSize": 22, "fontWeight": "bold",
"marginBottom": 14, "keepWithNext": true,
"hyphenation": "off"
},
"body": {
"fontSize": 10, "marginBottom": 10,
"allowLineSplit": true, "orphans": 2, "widows": 2,
"textAlign": "justify"
},
"kicker": {
"fontSize": 6.5, "letterSpacing": 1.2, "fontFamily": "Cousine",
"textAlign": "center", "marginBottom": 9, "keepWithNext": true
},
"table-cell": {
"fontFamily": "Cousine", "fontSize": 7,
"paddingTop": 3, "paddingBottom": 3, "paddingLeft": 4, "paddingRight": 4
}
}

Any element type you invent is valid — just add it to styles.


5. Block Element Types

json
{ "type": "heading", "content": "My Title" }
{ "type": "body", "content": "Plain paragraph." }
{ "type": "body", "content": "", "children": [ ... ] }

Special structural types handled by the engine:

typeRole
"story"Multi-column DTP zone; carries columns, gutter, balance as top-level keys
"table"Table container; optional table top-level key for config
"table-row"Row inside a table
"table-cell"Cell inside a row; supports colSpan, rowSpan in properties
"zone-map"Independent-region layout; zoneLayout + zones[] at top level
"strip"Horizontal slot layout; stripLayout + slots[] at top level
"image"Block or inline image; image data at top level

All other type strings are user-defined and look up styles only.

Use "content": "" (empty string) on container elements (table, story, zone-map, strip). Container elements and image elements do not require content but it's harmless to include it.


6. Top-Level Element Keys (AST 1.1)

In AST 1.1, several configuration objects moved out of properties and became top-level keys on the element. This is the most important change from 1.0.

KeyElement type(s)Purpose
contentallText content string
childrenall blockInline runs or child block elements
nameanyScripting target name
typeallElement type string
image"image"Image data (data, mimeType, fit)
table"table"Table config (headerRows, repeatHeader, columns, etc.)
dropCapany blockDrop cap config
columnSpanstory children"all" or number
placementstory childrenFloat/absolute placement directive
columns"story"Column count
gutter"story"Inter-column gap
balance"story"Equal-height column balancing
zones"zone-map"Array of zone definitions
zoneLayout"zone-map"Column sizing + gap config
slots"strip"Array of slot definitions
stripLayout"strip"Track sizing + gap config
propertiesallstyle, sourceId, colSpan, rowSpan, semanticRole, etc.

Exact `ElementProperties` interface (no other keys are valid):

typescript
interface ElementProperties {
style?: Partial<ElementStyle>; // inline style overrides
colSpan?: number; // table-cell only
rowSpan?: number; // table-cell only
sourceId?: string;
linkTarget?: string; // inline text/inline elements
semanticRole?: string; // "header" on table-row
reflowKey?: string;
keepWithNext?: boolean;
marginTop?: number;
marginBottom?: number;
pageOverrides?: {
header?: PageRegionContent | null;
footer?: PageRegionContent | null;
};
language?: string; // code blocks
}

colSpan and rowSpan remain inside properties (not top-level).


7. Inline Runs (Rich Text)

When a paragraph has mixed styling, use children instead of content. Set "content": "" at the paragraph level.

json
{
"type": "body",
"content": "",
"children": [
{ "type": "text", "content": "Normal text, then " },
{ "type": "text", "content": "bold", "properties": { "style": { "fontWeight": 700 } } },
{ "type": "text", "content": " and " },
{ "type": "text", "content": "italic", "properties": { "style": { "fontStyle": "italic" } } },
{ "type": "text", "content": " and a " },
{
"type": "text",
"content": "code span",
"properties": { "style": {
"fontFamily": "Cousine", "fontSize": 8.2,
"backgroundColor": "#ecdfc8", "color": "#4a2c0a",
"paddingLeft": 2, "paddingRight": 2
}}
},
{ "type": "text", "content": " and done." }
]
}
Inline styles quick-reference
EffectStyle property
Bold"fontWeight": 700 or "bold"
Italic"fontStyle": "italic"
Color"color": "#rrggbb"
Highlight"backgroundColor": "#rrggbb"
Monospace"fontFamily": "Cousine"
Larger/smaller"fontSize": N
Letter spacing"letterSpacing": N
Padding (code span)"paddingLeft": N, "paddingRight": N
Inline box (pill / badge)
json
{
"type": "inline-box",
"content": "LATIN",
"properties": { "style": {
"fontSize": 6, "fontFamily": "Cousine",
"backgroundColor": "#e0e8f0", "color": "#2a4a6a",
"padding": 2,
"borderWidth": 0.5, "borderColor": "#9ab",
"borderRadius": 2,
"verticalAlign": "baseline", "baselineShift": 0,
"inlineMarginLeft": 2, "inlineMarginRight": 2
}}
}
Inline image

image is a top-level key in AST 1.1. Size and alignment go in properties.style.

json
{
"type": "image",
"content": "",
"image": {
"data": "<base64>",
"mimeType": "image/png",
"fit": "contain"
},
"properties": {
"style": {
"width": 16, "height": 16,
"verticalAlign": "baseline", "baselineShift": 0,
"inlineMarginLeft": 1, "inlineMarginRight": 3
}
}
}

verticalAlign options: "baseline", "text-top", "middle", "text-bottom", "bottom".

GOTCHA: Do NOT use \u202f (narrow no-break space U+202F) in content strings — it is not in most font glyph sets and renders as □. Use a regular space or omit it.

8. Story: Multi-Column DTP Layout

json
{
"type": "story",
"content": "",
"columns": 3,
"gutter": 12,
"balance": false,
"children": [
{ "type": "body", "content": "Column text flows here..." },
...
]
}
  • columns — number of columns (default 1)
  • gutter — gap between columns in points
  • balance — if true, distributes content evenly across columns (avoid with float obstacles)

Column flow: depth-first. Col 1 fills completely before col 2 begins.

Story height = height of the tallest column. Adding more text to fill empty columns is safe — it flows into subsequent columns without increasing story height, as long as col 1 is already at max.

Estimating content fill:

  • Lines per column ≈ columnHeight / (fontSize × lineHeight)
  • Words per line ≈ columnWidth / (fontSize × 0.55) (rough estimate for proportional fonts)
  • Use the layout snapshot (--emit-layout) to measure actual column heights

9. Floats and Obstacles

Any block element inside a story can be floated using the top-level placement key.

Block floats — both properties.style.width and properties.style.height are required; if either is missing the element renders as a normal block instead.

json
{
"type": "pull-quote",
"content": "Any block can float — not just images.",
"placement": {
"mode": "float",
"align": "left",
"wrap": "around",
"gap": 8
},
"properties": {
"style": { "width": 120, "height": 60 }
}
}

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
630
Repository forks
34
7-day trend score
32

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/cosmiciron/vmprint/documents/badge)](https://verified-skill.com/skills/cosmiciron/vmprint/documents)

Something wrong with this skill or its page? Tell us.