shmd
extends 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 \Tue Jul 23 11:05:28 AEST 2024
>
> Current user \djl
>
> CPU model \
> EOF
<head>
tagThe syntax for embedding a command is \, e.g.
Build date: \Tue Jul 23 11:05:28 AEST 2024 => Build date: Tue Jul 23 11:05:28 AEST 2024
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 name=name
and content=value
.
Everything declared in the header section will be available as a shell variable,
(e.g. $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. hellofunc $author
).