Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support mdbook include syntax #34

Open
tg-x opened this issue Jun 9, 2023 · 1 comment
Open

support mdbook include syntax #34

tg-x opened this issue Jun 9, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@tg-x
Copy link

tg-x commented Jun 9, 2023

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)

@DCsunset DCsunset added the enhancement New feature or request label Jun 12, 2023
@tg-x
Copy link
Author

tg-x commented Jun 16, 2023

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants