Skip to main content

Pipe text into a code block in a markdown file.

Project description

pipe2codeblock

Pipe text into a code block in a markdown file.

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

Usage

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 README.md

to pipe the text in, or

p2c README.md 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

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

Pipe text into a code block in a markdown file.

positional arguments:
  outfile
  infile

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

Generated by dogfooding: p2c --help | p2c README.md

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 and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page