jneug / typst-codelst

A typst package to render sourcecode
MIT License
87 stars 5 forks source link

Properly support `showrange` in `sourcecode` #7

Open miestrode opened 11 months ago

miestrode commented 11 months ago

From what I can understand showrange is supposed to only show the specified line-range from the block. This is nice, however due to the way it is implemented, the shown line-range isn't highlighted like it would be if it were in the full block.

In my document for example I am writing a section in which a file is incrementally being made, and it would help if the syntax highlighting for each code block would work as if that code block was taken from the final code, resulting from combining all incremental ones. A proper implementation for showrange could also be useful for omitting parts of a code section (like how in Rust documentation for example, we generally omit writing a function for the code example).

miestrode commented 11 months ago

I've wanted to add to this issue that since Typst 0.9.0, you can use raw.line/raw.lines in order to achieve the effect needed here (like what I've done in sourcerer).