一个工具,用于将 5etools 或 pf2etools 中的 JSON 数据(对于您拥有的内容)转换为 Obsidian 友好型 Markdown。
一个工具,用于将 5etools 或 pf2etools 中的 JSON 数据(对于您拥有的内容)转换为 Obsidian 友好型 Markdown。
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.
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:
Terminal application.There are several options for running ttrpg-convert.
Choose the one you are most comfortable with:
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 |
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:
git diff --no-index vault/compendium/bestiary generated/compendium/bestiaryUse 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.
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.
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.
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.
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.
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.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-statblockad-flowchart, ad-gallery, ad-embed-action, ad-embed-feat, ad-embed-monster, ad-embed-object, ad-embed-race, ad-embed-spell, ad-embed-tablead-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.[!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
.exeto the command name (though it should work without).
Invoke the CLI with the --version option.
ttrpg-convert --versionYou should see output similar to the following:
ttrpg-convert version 2.3.18
Git commit: ed56f76If 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.
Invoke the CLI to generate indexes and markdown for SRD content:
ttrpg-convert \
--index \
-o dm \
--index generates two index files: all-index.json and src-index.json.
TIP:
- Use
all-index.jsonto see the reference keys for all discovered content. This can confirm that an included source was actually read.- Use
src-index.jsonto 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.
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:
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:
[!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
.exeto the command name (though it should work without).
Invoke the CLI with the --version option:
ttrpg-convert --versionYou should see output similar to the following:
ttrpg-convert version 2.3.18
Git commit: ed56f76If 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.
Invoke the CLI. In this first example, let's generate indexes and markdown for default content:
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.jsonto see the refe
暂无开放 Issues,或尚未同步最近议题。