Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to include portions of the file #9

Open
vstriz opened this issue Feb 8, 2017 · 2 comments
Open

Ability to include portions of the file #9

vstriz opened this issue Feb 8, 2017 · 2 comments

Comments

@vstriz
Copy link

vstriz commented Feb 8, 2017

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] !}

@vstriz vstriz changed the title ability to include portions of the file Ability to include portions of the file Feb 8, 2017
@holgerbrandl
Copy link

Along with the mentioned use-cases, it would be also great if the header of the included file could be stripped away (e.g. import statements)

{! include filename[skip=10] !}

@tiangolo
Copy link
Contributor

I'm using this extension for the docs for FastAPI and Typer. And I want this feature too (in particular for a new project). So I implemented it and made the PR here: #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants