Skip to main content

Pipe text into a code block in a markdown file.

Project description


Pipe text into a code block in a markdown file.

Originally designed for putting a terminal command's --help text into a


Put a fenced codeblock in your target file with the info string help.

The fenced codeblock is defined as it is by CommonMark, with the exception that it cannot be indented (to prevent spaces being lstripped inside the block).

Then do

your_awesome_tool --help | p2c

to pipe the text in, or

p2c input_file.txt

to read from a file.

The --tgt option allows you to choose which info string to target (instead of "help"). Only the first instance will be used.


usage: p2c [-h] [--tgt TGT] outfile [infile]

Pipe text into a code block in a markdown file.

positional arguments:

optional arguments:
  -h, --help  show this help message and exit
  --tgt TGT   Target a code block with a different info string (default

Generated by dogfooding: p2c --help | p2c

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pipe2codeblock, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pipe2codeblock-1.0.0.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page