FIXTradingCommunity / tablature

Easy authoring for rules of engagement using markdown
https://www.fixtrading.org/
Apache License 2.0
11 stars 8 forks source link

Support include of code snippets in a document #37

Closed donmendelson closed 2 years ago

donmendelson commented 3 years ago

Some technical specification documents include snippets of code examples or XML elements and the like. Those snippets should remain in source files that can be validated by a language interpreter. Also, source code may be subject to improvements, changes, or corrections over time, but if they are included into a markdown file by copy and paste, they become frozen. Therefore, it would be better to provide a syntax to include snippets dynamically when a Tablature file is processed.

Typically code snippets are bound by markdown fenced code blocks using "```". Rather than literally copying the code into the fenced block, the block would contain syntax to tell a Tablature processor to include a file or section of a file. The source file would need to be accessible at processing time.

donmendelson commented 3 years ago

The markdown parser should recognize fenced code blocks as a leaf block type, including info string. See https://github.github.com/gfm/#fenced-code-blocks

donmendelson commented 3 years ago

This should be a generic feature of module md-grammar, which is now in its own repository.