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 details)

Uploaded Source

File details

Details for the file pipe2codeblock-1.0.0.tar.gz.

File metadata

  • Download URL: pipe2codeblock-1.0.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for pipe2codeblock-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b7795ac21d61b6d2f0520d8699baa9b4d19d84612e0926678cff97af5f9bfbfd
MD5 691b7a74ecc103fbc5e9da77518c03ad
BLAKE2b-256 4e6998f167113bd954f0b99568ddf92a7be927f775ef7883146fde1440430dfd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page