shmdextends the markdown markup language to allow for embedding the result of shell commands in documents.
$ shmd < myshellmarkdownfile.md > mymarkdownfile.md $ shmd < myshellmarkdownfile.md | markdown > myhtmlfile.html $ shmd << EOF > # Example shmd > > The date is \Wed Nov 30 08:48:55 AEDT 2022 > > Current user \djl > > CPU model \ > EOF
The syntax for embedding a command is \, e.g.
Build date: \Wed Nov 30 08:48:55 AEDT 2022 => Build date: Wed Nov 30 08:48:55 AEDT 2022
The syntax for creating a header section is
/*\nname value\n*/, e.g.
/* title "SHMD: Shell markdown preprocessor" * author "Dylan Lom" * link stylesheet /main.css * hellofunc() "echo hello $1" */
Values with spaces should be quoted with either double (“) or single (‘) quotations.
You can pad each line in the header section with non-alphabetical characters, as demonstrated in the third line in the example.
The following head elements are recognised as HTML elements and may have specific syntaxes
Anything else will create a meta tag, with
Everything declared in the header section will be available as a shell variable,
$title will contain the value of title).
Functions declared in the title should be suffixed by (), as demonstrated in the
fifth line in the example, and can be invoked as per a regular user-defined
shell function (e.g.