pb
: Write once, publish anywhere
pb
is a command-line tool designed to facilitate a multi-platform, scientific
publishing workflow.
It allows you to write your posts locally using scientific-styled Markdown
(tables, code blocks, footnotes, and math formulas) and publish to external
hosts[^1] while maintaining the structure of the original post.
Installation
If you have the Go toolchain installed, then you can use go get
:
go get github.com/jdkato/pb
Otherwise, download one of the pre-built binaries.
Configuration
Medium
Uploading content to Medium requires an Integration token. To generate one, go to your settings page, select "Integration tokens" from the sidebar, and create one:
|
|
Select 'Integrations tokens' from the sidebar.
|
Create an Integration token; the description can be anything you want. |
Then, enter the pb configure
command, follow the instructions, and enter your token.
Usage
pb - A multi-platform publishing workflow.
Usage: pb [options] [command] [arguments...]
pb --to medium file.md
pb configure
pb is a tool for cross-posting Markdown content while preserving structural
elements (math typesetting, syntax highlighting, diagrams, etc.) across
multiple platforms.
Flags:
-h, --help Print this help message.
-d, --image-dir Search directory for local images.
-t, --to Comma-delimited list of destination platforms.
-v, --version Print the current version.
Commands:
configure Run an interactive configuration wizard.
The basic command is
pb -d <image path> <markdown file>
Where <image path>
is the directory where your local images are stored. For example, if you have an image definition like

and the file is stored at /some/path/static/img/medium-upload.gif
, then you'd use:
pb -d /some/path/static <markdown file>
[^1]: Currently, only Medium is supported. Other hosts, like DEV and Hashnode, will be added in a future release.