Skip to content

Fun with pandoc and shell scripts (terminal/bash) #99

@badlydrawnrob

Description

@badlydrawnrob

Also see static compiler issue in my portfolio repository

I'm an absolute beginner with bash and not really interested in learning it, but for simple websites, PDFs, and other static content, these commands could be handy. It's a lot easier than static site generators.

Single file

To concatenate files (combine files into a single .html file)

pandoc --template=./source/pandoc-template.html --css=./static/styles.css ./partials/*.md ./partials/metadata.yaml -s -o ./build/output.html

Multiple files

To process multiple files (and export each as .html file). The ; is necessary for one-line commands.

for file in ./source/*.md; do
    pandoc --template=./source/pandoc-template.html -c ../static/styles.css -s "$file" -o "./build/$(basename "$file" .md).html";
done

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions