Last active
August 24, 2023 14:26
-
-
Save neumantm/bca0e942859f73db59cd273e5e13f5a3 to your computer and use it in GitHub Desktop.
Build Markdown with PlantUml snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: editor.pdf language.pdf | |
BUILD_LANGUAGE_MD:=.build_language_md | |
IMG_EXTENSIOM:=svg | |
editor.pdf: editor.md | |
pandoc -f gfm -i $< -o $@ | |
language.pdf: ${BUILD_LANGUAGE_MD}/language.md ${BUILD_LANGUAGE_MD}/imgs/ | |
pandoc -f gfm -i $< -o $@ | |
${BUILD_LANGUAGE_MD}/language.md: ${BUILD_LANGUAGE_MD} language.md | |
cat language.md | perl -p0e 's/```plantuml\n\@startuml (.*)\n(.*|\n)*?\@enduml\n```/![$$1](${BUILD_LANGUAGE_MD}\/imgs\/$$1.${IMG_EXTENSIOM})/g' > ${BUILD_LANGUAGE_MD}/language.md | |
${BUILD_LANGUAGE_MD}/imgs/: ${BUILD_LANGUAGE_MD} language.md | |
mkdir -p ${BUILD_LANGUAGE_MD}/imgs/ | |
docker run -u $$(id -u):$$(id -g) -v $$(pwd):/src --rm plantuml/plantuml -t${IMG_EXTENSIOM} -o /src/${BUILD_LANGUAGE_MD}/imgs/ /src/language.md | |
${BUILD_LANGUAGE_MD}: | |
mkdir -p ${BUILD_LANGUAGE_MD} | |
.PHONY: clean | |
clean: | |
rm -f *.pdf | |
rm -rf ${BUILD_LANGUAGE_MD} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
editor.md
is a file without any plantuml andlanguage.md
is one with embedded plantuml.The plantuml is embedded in a way, that the vscode extension
PlantUML
automatically renders them in the preview: