/* * title "SHMD: Shell markdown preprocessor" * author "Dylan Lom" * charset utf8 */ # $(echo "$title") ================= > `shmd` extends the markdown markup language to allow for embedding the result > of shell commands in documents. [Source Code][1] ## Examples $ shmd < myshellmarkdownfile.md > mymarkdownfile.md $ shmd < myshellmarkdownfile.md | markdown > myhtmlfile.html $ shmd << EOF > # Example shmd > > The date is \$(date) > > Current user \$(whoami) > > CPU model \$(cat /proc/cpuinfo | grep 'model name' | head -1 | cut -d':' -f2) > EOF ## Features * Embedding output of shell commands * Header for declaring variables available within the document * Outputting header information inside of a HTML `` tag * Declaration of functions in the header, available in commands ## Usage The syntax for embedding a command is \$(command), e.g. Build date: \$(date) => Build date: $(date) The syntax for creating a header section is `/*\nname value\n*/`, e.g. /* title "$(echo $title)" * author "$(echo $author)" * 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 * charset (i.e. charset utf8) * title (i.e. title title) * link (i.e. link rel href) 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`). [1]: https://github.com/dylan-lom/shmd