Docker, Markdown, Pandoc & PlantUml

August 31, 2022

Goal

  • Mechanism to automatic generation static documentation in HTML from markdown documents.
  • Markdown language is selected to generate low entry level to write documentation also supporting plantuml syntax.
  • Markdown files contains images, plantuml diagrams, code snippets, tables, etc. following preparation of functional document

Technical solution

What I did

#. Setup Docker environment

FROM ubuntu:22.04

RUN apt-get update
RUN apt-get install pip -y
RUN apt-get install plantuml -y
RUN apt-get install wget -y 
RUN wget https://github.com/jgm/pandoc/releases/download/2.19.2/pandoc-2.19.2-1-amd64.deb
# https://www.pandoc.org/installing.html#linux
RUN dpkg -i pandoc-2.19.2-1-amd64.deb
RUN rm pandoc-2.19.2-1-amd64.deb
RUN pip install pandoc-plantuml-filter
  • Build docker image with
#!/bin/sh
# Execute command test.sh
docker build -t blog-processor-ubuntu .
docker scan --json blog-processor-ubuntu
  • Execute command to container mounting sources:
# powershell command
docker run -it --rm -a stdin -a stderr -a stdout --name blog-processor-cntr-wip --mount type=bind,src="/path/to/src/folder",dst=/mnt/src -e PWD=/mnt/src/ --entrypoint /mnt/src/generate_pages.sh blog-processor-ubuntu
#!/bin/sh
find ${PWD}/WebPage -iname "*.md" -type f -exec sh -c 'pandoc --defaults ${PWD}/generate_pages.yaml -o "${0%.md}.html" "${0}" && echo "Generated: ${0%.md}.html" && mv "${0%.md}.html" ${PWD}/output' {} \;

Profile picture

Written by Lukasz Czarny Developer on a path to Software Architect You should follow them on Twitter

© Software Architecture by Cases 2022