-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-plugin-embed-snippet] Support for embedding specific line numbers #21906
Comments
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Thanks again for being part of the Gatsby community! 💪💜 |
Closed by #21907 |
Summary
DocFX has a feature in its inclusion of code snippets that allows you to specify a line number or line range to embed specific lines of an external file.
It works the same way as GitHub file URLs, where ending the URL with
#L10
or#L10-L20
will link to those lines.I propose that
gatsby-remark-embed-snippet
should also support this behaviour by trimming the embedded files using the agreed upon#Lx
and#Lx-Ly
syntax.Basic example
Add logic to the embed-snippet plugin to add support for including a snippet by line number or line range. Basically:
If the
embed:
line contains#L
, grab the hash and remove it from the path (it's not a valid file path). Then use the requested lines in the hash to split the embedded file and display only the requested line number(s).Motivation
The use case for this feature is building tutorial pages which give the user only the parts of the code example that they require at the current step.
I am migrating from DocFX and am trying to get 100% feature parity to be able to convince my company to move to Gatsby.
The text was updated successfully, but these errors were encountered: