skip to main content

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

shorthand

A simple label or macro expander

Example use cases:

The supported command line options can be listed using the -help option.

    shorthand -help

Source code can be found at github.com/rsdoiel/shorthand

The project website is rsdoiel.github.io/shorthand

Tutorial

Timestamp in Markdown file

If the content of the markdown file testdata/report.md was


    Report Date: @now

    # Topic: The current local time.

    This report highlights the current local time of rendering this document

    The current local time is @now

Put the definitions in a file of their own, now.shorthand

    :bash: @now date

and give it to shorthand before the document, then render the result with pandoc

    shorthand now.shorthand testdata/report.md | pandoc -s > testdata/report.html

What this command does is read the definitions, then the document, and replace all occurrences of “@now” in the document with the output from the Unix program date.

The output (before piping to Pandoc) would look something like

    Report Date: Sat Aug 29 11:25:48 PDT 2015

    # Topic: The current local time.

    This report highlights the current local time of rendering this document

    The current local time is Sat Aug 29 11:25:48 PDT 2015

Notice that both “@now” are replace with the same date information.

embedding shorthand definitions

You could also embed the shorthand definitions straight in the markdown itself. with something like

    :bash: @now date

    Report Date: @now

    # Topic: The current local time.

    This report highlights the current local time of rendering this document

    The current local time is @now

That makes the command line a little shorter

    shorthand testdata/report.md | pandoc -s > testdata/report.html

Installation

shorthand can be installed with the go install command.

    go install github.com/rsdoiel/shorthand/cmd/shorthand@latest

Documentation