gpoore / minted

minted is a LaTeX package that provides syntax highlighting using the Pygments library. Highlighted source code can be customized using fancyvrb.
1.74k stars 126 forks source link

[Feature request] named code segments #394

Closed AntonC9018 closed 4 months ago

AntonC9018 commented 4 months ago

It could be useful to have named segments in a source file, and be able to import segments by name from latex, to remove the dependency on code not moving around when specifying concrete line numbers.

Imagine a source file like this:

...
// Test segment begin
...
// Test segment end
...
\inputminted[segmentbegin=// Test segment begin, segmentend=// Test segment end]{lang}{file.lang}

I'm doing it with a custom script right now in my stuff.

gpoore commented 4 months ago

Duplicate of #373.

This is now possible in v3.0.0beta1. If you would like to experiment with the beta version, installation instructions are here and the CHANGELOG includes details about new features (the PDF documentation won't be fully updated until the final v3 release). Otherwise, the final v3 release should be available sometime in June.