neurobin/mdx_include

Ability to include portions of the file

neurobin opened this issue · 1 comments

This is a nice idea mentioned at cmacmackin/markdown-include#9

by @vstriz

I'm writing a user guide and it would be nice to include section of the external file. Either by specifying line numbers or named section. I previously used asciidoc include feature and found this capability extremely useful.

Referring to actual tested code makes sure that your examples in docs are not out of date, but you also don't want to include noise like imports, etc... And often just a small part of a class demonstrate a particular aspect you're describing.

http://asciidoctor.org/docs/user-manual/#include-basics
E.g.

include::filename.txt[lines="1..10,15..20"]
include::core.rb[tags=parse]

I'm not sure how you'd specify this exactly but perhaps some variation of :

{! include filename[lines=1..20] !}
{! include filename[tags=snippet1] !}

{! filename [ln:1-2,2-3] !} syntax has been chosen and is available in latest release. [tags=snippet1] won't be implemented.