For my personal needs I implemented a new feature: !(EXEC cmd) to execute a command (with shell) and replace the syntax by its result.
This can be useful for automating the generation of a Markdown file, for instance inserting the current date (or, say, a version number):
Project version: !{EXEC bash -c "./get_version.sh"}Date of today: !(EXEC date)
It is also possible to escape it; that's how the readme.mdpp is able to process correctly
\!(EXEC This will not execute)
If there are parenthesis/braces/brackets in the EXEC command, right now it will pose issues because I implemented it using a simple regexp (one would require a grammar to take care of matching parenthesis).
The workaround is to use different delimiters ; there are three available, parenthesis, brackets and braces
\![EXEC echo "A command with different delimitors"]
Hello,
For my personal needs I implemented a new feature:
!(EXEC cmd)
to execute a command (with shell) and replace the syntax by its result.This can be useful for automating the generation of a Markdown file, for instance inserting the current date (or, say, a version number):
Project version: !{EXEC bash -c "./get_version.sh"}
Date of today: !(EXEC date)
It is also possible to escape it; that's how the
readme.mdpp
is able to process correctly\!(EXEC This will not execute)
If there are parenthesis/braces/brackets in the EXEC command, right now it will pose issues because I implemented it using a simple regexp (one would require a grammar to take care of matching parenthesis).
The workaround is to use different delimiters ; there are three available, parenthesis, brackets and braces
\![EXEC echo "A command with different delimitors"]
By using the PR https://github.com/jreese/markdown-pp/pull/79 I was able to pass all tests, except one (
exec_file
) which required to correct a minor bug (see commit https://github.com/jreese/markdown-pp/pull/80/commits/23c23f1cd1c3a44ae9f9143abebd8ba61bdebd62)I'm open to any change