How to selectively include files?

I have a main file and a chapter file which i include in the main file. But the chapter file is created using pandoc and adds some additional content at the beginning. Is it possible to somehow specify in the main file that the first n lines of chapter file should be skipped? Or is it possible to specify in the main file that the first n lines of chapter file should be treated as comment?

Thank you

You could load the file via read, strip a few lines and include the file via eval:

#eval(
  read("file.typ")
    .split("\n")
    .slice(7)
    .join("\n"),
  mode: "markup"
)

There could potentially be issues if you want to include other files in the such processed file though.

1 Like

Thank you so much! Wasn’t really expecting this to get solved actually. Luckily it also works with an import statement with some tweaking and using relative paths.

1 Like