Skip to content

Conversation

@kainctl
Copy link
Contributor

@kainctl kainctl commented Jan 4, 2026

Hey,

first, thanks for creating and maintaining this filter!
For a personal project, I sometimes also need to include the contents of source code files into the final document as a "raw" code-block.
(For example, this project's README.md could include the source code of the sample.md file.)

As this filter already handles includes I thought it might be nice to add the include-as-code-block feature to this filter as well, avoiding having to include two files for "fairly" similar features. (Although internally include-as-code-block is quite a bit simpler.)

I understand that this might not be the exact goal of this filter, so feel free to close this PR if you feel like it does not belong to it.

PS: Happy to update the documentation and maybe clean up the code a bit if you would consider it relevant for the upstream repository.

@tarleb
Copy link
Member

tarleb commented Jan 6, 2026

There is the include-code-files filter, which still resides in the semi-retired lua-filters repository. There were discussions before about merging that filter into this one, but, as I remember, the consensus was that they are different enough to justify two separate filters.

We've been trying to move the most useful filters into separate repositories, but only if there's somebody willing to maintain it. I believe this wasn't done yet in this case. If we move this filter into this org, could I convince you to co-maintain it?

@tarleb
Copy link
Member

tarleb commented Jan 6, 2026

I have cherry-picked the fix that makes more functions local, thanks for that. However, I reverted the change to transclude, because that's a recursive function. It's a bit of a Lua quirk that the variable needs to be declared before the function can be defined, so the local on a separate line is correct and cannot be changed.

@kainctl
Copy link
Contributor Author

kainctl commented Jan 6, 2026

We've been trying to move the most useful filters into separate repositories, but only if there's somebody willing to maintain it. I believe this wasn't done yet in this case. If we move this filter into this org, could I convince you to co-maintain it?

You mean have a separate repository only for the include-as-code-block filter? If it isn't merged into this repository, I am not sure if I would like to maintain it. Would I still be free to set up my own "test-infrastructure" as I would see fit?

However, I reverted the change to transclude, because that's a recursive function. It's a bit of a Lua quirk that the variable needs to be declared before the function can be defined, so the local on a separate line is correct and cannot be changed.

I am confused about this. 🤔 The test passed and I don't see any issues? And isn't my version just syntax sugar for your version? Do have a reference or example where it fails?

@tarleb
Copy link
Member

tarleb commented Jan 6, 2026

You're completely right about the local, looks like I remembered that wrong.

I'm very open towards new test-infrastructure as long as it doesn't pose a security risk and doesn't complicate maintenance if you choose to leave the project. I'll try to move the filter sometime later this week. We're all doing this in our free time, so don't feel bad if you choose to opt out at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants