nuex / zodiac

A static website generator written in awk and sh.
MIT License
240 stars 22 forks source link

Support multiline codeblocks #15

Open travispaul opened 4 years ago

travispaul commented 4 years ago

It looks like a single backtick ` is to be used for code blocks: https://github.com/nuex/zodiac/blob/master/lib/markdown.awk#L104

An example such as this works as expected:

`env | grep FOO`

becomes:

<p><code>env | grep FOO</code></p>

But I cannot seem to get a multiline code block to work. For example, this:

`if [ ! -f ./conf.sh ]; then
    redln "No conf file found"
    echo "Create ./conf.sh"
    exit 2
fi`

becomes:

<p><code>if [ ! -f ./conf.sh ]; then    redln "No conf file found"  echo "Create ./conf.sh" exit 2fi</code></p>
c0dev0id commented 1 year ago

The easiest "fix" is to use custom markdown parser as outlined in the README. The included awk parser really only does the bare minimum.

The single-backtick notation is not meant for multiline anyway. The proper markdown syntax is:

``` if [ ! -f ./conf.sh ]; then redln "No conf file found" echo "Create ./conf.sh" exit 2 fi ```