pandoc-include icon indicating copy to clipboard operation
pandoc-include copied to clipboard

support mdbook include syntax

Open tg-x opened this issue 2 years ago • 1 comments

It would be nice to have an option to support the mdbook include syntax, that'd help portability of markdown documents across tools (e.g. using mdbook to generate html and pandoc to generate pdf from the same markdown files)

tg-x avatar Jun 09 '23 10:06 tg-x

here's a regex to convert mdbook includes to pandoc-include format:

FORMAT=commonmark_x sed 's/{{#include *\([^}]\+\):\([^}]\+\)}}/!include\`format="$FORMAT", snippetStart="<!-- ANCHOR: \2 -->", snippetEnd="<!-- ANCHOR_END: \2 -->"\` "\1"/; s/\[\([^]]\+\)\](\([^)]\+\.md\)#\([^)]\+\))/[\1](#\3)/g; s/{{#include *\([^:}]\+\)}}/!include\`format="$FORMAT"\` "\1"/; s/\[\([^]]\+\)\](\([^)]\+\.md\)#\([^)]\+\))/[\1](#\3)/g'

tg-x avatar Jun 16 '23 10:06 tg-x