Closed tekknolagi closed 6 years ago
That's a good suggestion! I usually don't use .numberLines
, but I can see how that would be useful. The filter could detect numberLines
being in the classes, and add the appropriate the startFrom
attribute. The issue right now is that the snippet
support is a bit hacky. If you want to have a stab at it, let me know!
In fact, I'm giving this an hour of refactoring and trying it out. :)
I'm working on this branch: https://github.com/owickstrom/pandoc-include-code/tree/snippet-line-numbers
So far I've only restricted the filter a bit, prohibiting the "range mode" and "snippet mode" of inclusion being used together. This is to make the program flow simpler before adding the startFrom
support, which should be pretty straightforward now.
I think this should be working now. Can you try installing from the branch I referred to? Thanks!
Oh, wow. I'll take a look!
I'm not sure I'm doing it right. I have {include=a-pdf.py .python .numberLines snippet=plasma-equation}
and {.python .numberLines include=a-pdf.py snippet=bisect-rootfind}
, but the line numbers for both snippets start at 1.
Actually, this appears to work. I think I was looking at the wrong PDF. Awesome, thanks!
Nice! I'll merge it then, and close the ticket. Also releasing a new version on Hackage.
Closed by #10.
I'm not sure how would be the best way to do this, but it would be nice to be able to do something like: