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.

Source Distribution

pipe2codeblock-1.0.0.tar.gz (2.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page