I couldn't find this anywhere on the internet and struggled to figure out how to do this so I'm hoping github's seo is good enough that it helps someone else.
Files must be within the content dir or the project root, and are relative to those places. Symlinks are followed, though.
I'm not sure which order they're checked, but in the following examples,
hugo will look in PROJECT_ROOT/content/code-samples/example.rs
and
PROJECT_ROOT/code-samples/example.rs
and use whichever it finds first.
lines 0-15
{{< code file="code-samples/example.rs" language="rust" to=15 >}}
lines 15-38
{{< code file="code-samples/example.rs" from=15 to=38 >}}
lines 38-end
{{< code file="code-samples/example.rs" from=38 >}}
Thank you very much for this! 🤓