Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

ttrpg-convert-cli

> 开发工具
Open source

Utility to convert JSON data (for content you own) from 5etools or pf2etools into Obsidian-friendly Markdown.

372 stars0 likes2 views
WebsiteGitHub

About

Utility to convert JSON data (for content you own) from 5etools or pf2etools into Obsidian-friendly Markdown.

TTRPG convert CLI

A Command-Line Interface designed to convert TTRPG data from 5eTools and Pf2eTools into crosslinked, tagged, and formatted markdown optimized for Obsidian.md.

Jump ⬇ Download ⚙️ Configuration Examples Templates

Changelog ️ Source Map 5eTools Pf2eTools Homebrew

I use Obsidian to keep track of my campaign notes. This project parses JSON sources for materials that I own from the 5etools mirror to create linked and formatted markdown that I can reference in my notes.

[!TIP]

  • Review the changelog for new capabilities (✨) and breaking changes ().
  • Check out Conventions and Recommendations.

Using the Command Line

This tool works in the command line, which is a text-based way to give instructions to your computer. If you're new to it, we have resources to help you get started below.

If you don't have a favorite method already, or you don't know what those words mean, here are some resources to get you started:

  • For macOS / OSX users:
    • Start with the built-in Terminal application.
    • Learn the macOS Command Line
  • For Windows users:
    • A Beginner's Guide to the Windows Command Line
    • See the Windows README

Install the TTRPG Convert CLI

There are several options for running ttrpg-convert. Choose the one you are most comfortable with:

  • Using Windows? See the Windows README.
  • jbang: Use JBang! (hides Java; sets up command aliases).
  • brew: Use Homebrew (macOS or Linux) (uses platform binaries).
  • bin: Use a pre-built platform binary (no Java required).
  • jar: Use Java to run the jar.
  • src: Build from source.
Platform Options
Linux jbang, brew, bin, jar, src
Mac (Arm) brew, jbang, bin, jar, src
Mac (Intel) brew, jbang, bin, jar, src
Windows , jbang, bin, jar, src
Windows (Old) , jbang, jar, src
Windows (WSL) brew, jbang, jar, src

Recommendations for using the CLI

  • Treat generated content as a big ball of mud. Stick it in a corner of your vault and treat it as read-only.

    Trust us, you will want to regenerate content from time to time. It is cheap and easy to do if you don't have your own edits to worry about.

  • Have the CLI generate output into a separate directory and use a comparison tool to preview changes.

    You can use git diff to compare arbitrary directories. For example:

    bash
    git diff --no-index vault/compendium/bestiary generated/compendium/bestiary
  • Use a copy tool that only updates modified files, like rsync, to avoid unnecessary file copying when updating your vault. Use the checksum option (-c) to compare file contents; the file modification date is meaningless given generated files are recreated when the tool is run. We have some suggestions in discussion #220, but it is very much a work in progress.

Required Plugins

  • Admonitions (git/obsidian): The Admonitions plugin supports a codeblock style admonition used for more complex embedded content. See Admonition plugin notes for more recommendations.

Recommended Plugins

  • Force Note View Mode by Front Matter (git/obsidian): I use this plugin to treat these generated notes as essentially read-only. See Force Note View Mode plugin settings for recommendations.

  • Fantasy Statblocks (git/obsidian): Templates for rendering monsters can define a statblock in the document body or provide a full or abridged YAML monster in the document header to update monsters in the plugin's bestiary.

    • See Fantasy Statblocks plugin settings for recommendations.
    • See Templates for related template customization.
  • Initiative Tracker (git/obsidian): Templates for rendering monsters can include information in the header to define monsters that the Initiative Tracker can use when constructing encounters. See Initiative Tracker plugin settings for recommendations.

Conventions

  • Links. Documents generated by this plugin will use markdown links rather than wiki links. A CSS snippet can make these links less intrusive in edit mode by hiding the URL portion of the string.

  • File names. To avoid conflicts and issues with different operating systems, all file names are slugified (all lowercase, symbols stripped, and spaces replaced by dashes). This is a familiar convention for those used to Jekyll, Hugo, or other blogging systems.

    • File names for resources outside of the core books (PHB, MM, and DMG) have the abbreviated source name appended to the end to avoid file name collisions.
    • All files have an aliases attribute that contains the original name of the resource.
  • Organization. Files are generated in two roots: compendium and rules. The location of these roots is configurable. These directories will be populated based on the sources you have enabled.

    • compendium contains files for items, spells, monsters, etc. The compendium directory is further organized into subdirectories for each type of content. For example, all items are in the compendium/items directory.

    • rules contains files for conditions, weapon properties, variant rules, etc.

    • css-snippets will contain CSS files for special fonts used by some content. You will need to copy these snippets into your vault (.obsidian/snippets) and enable them (Appearance -> Snippets) to ensure all content in your vault is styled correctly.

  • Styles. Every document has a cssclasses attribute that assigns a CSS class. We have some CSS snippets that you can use to customize elements of the compendium.

    • 5eTools: json5e-background, json5e-class, json5e-deck, json5e-deity, json5e-feat, json5e-hazard, json5e-item, json5e-monster, json5e-note, json5e-object, json5e-psionic, json5e-race, json5e-reward, json5e-species, json5e-spell, and json5e-vehicle.
    • Pf2eTools: pf2e, pf2e-ability, pf2e-action, pf2e-affliction, pf2e-archetype, pf2e-background, pf2e-book, pf2e-deity, pf2e-feat, pf2e-hazard, pf2e-index, pf2e-item, pf2e-note, pf2e-ritual, pf2e-spell, pf2e-trait.
  • Admonitions. Generated content uses code-block-style Admonitions in addition to Obsidian callouts. We have Admonition definitions that you can import to ensure these admonition/callout types are defined.

    • ad-statblock
    • 5eTools: ad-flowchart, ad-gallery, ad-embed-action, ad-embed-feat, ad-embed-monster, ad-embed-object, ad-embed-race, ad-embed-spell, ad-embed-table
    • Pf2eTools: ad-embed-ability, ad-embed-action, ad-embed-affliction, ad-embed-avatar, ad-embed-disease, ad-embed-feat, ad-embed-item, ad-pf2-note, ad-pf2-ritual.

Convert 5eTools JSON data

[!NOTE] Instructions here use backslashes to wrap lines for readability (a common practice for Linux-based command shells).

If you are using Windows, you will need to remove the backslashes and put the command on a single line. You may also need to append .exe to the command name (though it should work without).

  1. Invoke the CLI with the --version option.

    bash
    ttrpg-convert --version

    You should see output similar to the following:

    bash
    ttrpg-convert version 2.3.18
    Git commit: ed56f76

    If you do, we know that the CLI is working!

    If you don't, there may be something wrong with your installation. Windows users, see the Windows README for help.

  2. Invoke the CLI to generate indexes and markdown for SRD content:

    bash
    ttrpg-convert \
      --index \
      -o dm \
      
    • --index generates two index files: all-index.json and src-index.json.

      TIP:

      • Use all-index.json to see the reference keys for all discovered content. This can confirm that an included source was actually read.
      • Use src-index.json to see the reference keys for content that was included in the generated output. Use this to confirm that your source selection is working as expected.
    • -o dm The target output directory (dm in this case). Files will be created in this directory.

    • `` is a placeholder for the location of downloaded 5eTools source data directory.

    This should produce a set of markdown files in the dm directory that contains only SRD content.

  3. Next, you'll want to create a configuration file to set up your sources.

    The configuration is provided to the CLI using the -c option:

    bash
    ttrpg-convert \
        --index \
        -o dm \
        -c my-config.json \
        

    Note: Only include content you own. Find the identifier for your sources in the Source Map.

Next step:

  • Create your own configuration file.

Convert Pf2eTools JSON data

[!NOTE] Instructions here use backslashes to wrap lines for readability (a common practice for Linux-based command shells).

If you are using Windows, you will need to remove the backslashes and put the command on a single line. You may also need to append .exe to the command name (though it should work without).

  1. Invoke the CLI with the --version option:

    bash
    ttrpg-convert --version

    You should see output similar to the following:

    bash
    ttrpg-convert version 2.3.18
    Git commit: ed56f76

    If you do, we know that the CLI is working!

    If you don't, there may be something wrong with your installation. Windows users, see the Windows README for help.

  2. Invoke the CLI. In this first example, let's generate indexes and markdown for default content:

    bash
    ttrpg-convert \
      -g pf2e \
      --index \
      -o dm \
      
    • -g pf2e The game system! Pathfinder 2e!

    • --index generates two index files: all-index.json and src-index.json.

      TIP:

      • Use all-index.json to see the refe

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java5e-tools5etoolsdnd5edungeons-and-dragons

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具