mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

Is there a way to use own markdown short code templates?

Open DrGo opened this issue 1 year ago • 2 comments
trafficstars

Question

I want to customize the #include short code (I believe implemented using handlebar templates) so that the I could output the path of the included file as well as its content, e.g.,

book/ch1/example1.rs 
fn main() {}

I was thinking this could be achieved by somehow including my template, e.g.,

{{#myinclude path/to/file}}

It is possible to do that using mdbook itself or do I need a preprocessor? If so, any recommendations? Thanks,

Version

No response

DrGo avatar May 18 '24 21:05 DrGo

You will likely need a preprocessor for that use case.

ehuss avatar May 20 '24 17:05 ehuss

pitty... because such templates are very useful and can be easily implemented using the already builtin handlebar functionality.

DrGo avatar May 20 '24 17:05 DrGo

I'm going to close per the comment above.

ehuss avatar Jun 02 '25 17:06 ehuss