Shorthand - a simple label expander and markdown processor

shorthand

A simple label expander and markdown utility

Example use cases:

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

    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

From the command line you can do something like this

    shorthand -e '@now :bash: date' \
        -e "@report :import-text: testdata/report.md" \
        -e "@html :markdown: @report" \
        -e "@html" \
        -e ':exit:' > testdata/report.html

What this command does is launch the shorthand interpreter and it replaces all occurrences of “@now” in the markdown document with the output from the Unix program date.

The output would look something like

    <p>Report Date: Sat Aug 29 11:25:48 PDT 2015</p>

    <h1>Topic: The current local time.</h1>

    <p>This report highlights the current local time of rendering this document</p>

    <p>The current local time is Sat Aug 29 11:25:48 PDT 2015</p>

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

embedding shorthand definitions

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

    @now :bash: 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 -markdown testdata/report.md > testdata/report.html

Installation

shorthand can be installed with the go get command.

    go get github.com/rsdoiel/shorthand/...