Skip to content

Dev-Ray-Hunt/Obsidian-advanced-print

Repository files navigation

RPG Print

An Obsidian plugin that renders your Markdown notes in the visual style of a D&D 5e sourcebook — two-column layout, stat blocks, spell cards, ornate styling, and one-click Print to PDF.

Inspired by Homebrewery, GM Binder, and brewdown.


Features

  • D&D Preview Tab — Live preview that updates as you type, rendered in D&D book style inside an isolated iframe
  • CSS Editor Tab — Edit your theme CSS live with instant preview; save, switch, and create multiple themes
  • Print to PDF — One button opens the Chromium print dialog scoped to just your D&D page
  • Two-column layout — Automatic PHB-style two-column page layout
  • Stat blocks, spell cards, note boxes — Special markdown syntax (see below)
  • Custom themes — Themes are plain .css files stored in your vault — version them, share them, edit them

Installation

This plugin is not yet in the Obsidian Community Plugins directory. Install manually:

  1. Clone or download this repository into your vault's plugins folder:
    <your vault>/.obsidian/plugins/rpg-print/
    
  2. In that folder, run:
    npm install
    npm run prepare-assets
    npm run build
  3. In Obsidian: Settings → Community Plugins → Installed Plugins → enable RPG Print

Usage

Opening the views

  • Ribbon — Click the open-book icon for the Preview, or the paintbrush icon for the CSS Editor
  • Command palette (Cmd/Ctrl + P) — Search for "RPG Print"

Workflow

  1. Open a Markdown note
  2. Run "Open RPG Print Preview" — the preview tab appears showing your note styled as a D&D book
  3. Edit your note — the preview updates within ~300ms
  4. Run "Open RPG Print CSS Editor" — edit the CSS live; the preview updates immediately
  5. Click Save in the CSS Editor to write your changes to disk
  6. Click Print to PDF in the Preview to open the print dialog

D&D Markdown Syntax

All special syntax is processed by brewdown.

Page break

\newpage

Starts a new page <div class="page">. Everything after this marker is on a fresh page.

Column break

\newcolumn

Forces a column break in the two-column layout.

Stat block

::: stats
**Armor Class** 13 (leather armor)
**Hit Points** 45 (7d8 + 14)
**Speed** 30 ft.

{abilities: STR=16, DEX=12, CON=14, INT=10, WIS=8, CHA=8}

**Skills** Stealth +3
**Senses** passive Perception 9
**Languages** Common
**Challenge** 1 (200 XP)
:::

The {abilities: ...} line auto-calculates ability score modifiers.

Wide stat block (spans both columns)

::: stats-wide
...
:::

Description box (italicized flavor text)

"""description
This creature lurks in the shadows of ruined temples, feeding on fear.
"""

Note box (rules text)

"""note
**Multiattack.** The creature makes two attacks: one with its bite and one with its claws.
"""

Class table

::: classtable
| Level | Proficiency | Features |
|-------|-------------|---------|
| 1st   | +2          | Rage     |
:::

Cover page

::: cover
# My Homebrew Compendium
### A Supplement for D&D 5e
:::

Themes

Themes are .css files stored in the RPG-Themes/ folder inside your vault (configurable in Settings).

Switching themes

Open the CSS Editor tab and use the dropdown at the top.

Creating a new theme

Click New Theme in the CSS Editor — it copies your current theme as a starting point.

Editing a theme

Edit the CSS directly in the CSS Editor textarea. Changes apply live to the preview. Click Save to write to disk.

Default theme (PHB.css)

The plugin ships a starter theme styled like the D&D 5e Player's Handbook. It uses Cinzel and EB Garamond from Google Fonts — requires an internet connection. For offline use, remove the @import line and rely on system serif fonts.


Settings

Settings → RPG Print

Setting Default Description
Themes folder RPG-Themes Vault-relative path where theme .css files are stored
Page size letter letter, a4, or legal

Development

npm install            # Install dependencies
npm run prepare-assets # Base64-inline brewdown images into src/assets/brewdown-base.css
npm run dev            # Watch mode — auto-rebuilds on save
npm run build          # Production build

After npm run dev, reload Obsidian (or use the Hot-Reload plugin) to pick up changes.

File structure

src/
  main.ts             — Plugin entry point
  renderer.ts         — markdown-it + brewdown integration
  theme-manager.ts    — Theme file I/O + event bus
  settings.ts         — Settings tab UI
  constants.ts        — View type strings, defaults
  types.ts            — TypeScript interfaces
  views/
    preview-view.ts   — D&D preview (iframe-based)
    css-editor-view.ts — CSS editor tab
  assets/
    brewdown-base.css — Generated: brewdown CSS with images base64-inlined
    default-theme.css — Starter PHB-style theme
scripts/
  prepare-assets.mjs  — One-time asset preparation script

Credits

  • brewdown by Tom Wolfe — D&D markdown-it rules (MIT)
  • Homebrewery — inspiration for styling and layout
  • GM Binder — inspiration for the editing workflow

About

Obsidian plugin for rendering markdown notes as D&D PHB-style PDF-ready documents

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors