Implement Projbook's Snippet include feature
FransBouma opened this issue · comments
Projbook supports inclusion of snippets from external files. This is particularly helpful if you e.g. want to include a method or class from a C# file into documentation: by using the inclusion of a snippet, the original text is included as a fenced codeblock and it's not a burden to keep things in-sync.
The proposed syntax is:
@snippet
language [filename] pattern
As Projbook is MIT licensed, we can include their extractors for C#, XML and plain text, and use that. The C# extractor is particularly helpful as it's based on Roslyn and supports some neat syntax. See: http://defrancea.github.io/Projbook/projbook.html#Pageextractormd-c--pattern
In the syntax above:
- language is either
cs
,xml
ortxt
. If an unknown string is specified,txt
is assumed. The language is used for which extractor is used, and also for the language for the resulting fenced code block. - filename is a filename to the file to read the snippet from, which is relatively specified to the markdown document the statement is specified in.
- pattern is the pattern to pass to the extractor and this follows the Projbook syntaxis.
Tasks:
- Implement code
- Add @snippet statement to docs
- Add ProjBook theme
Implemented