Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow template to be passed via meta argument? #14

Open
TimTaylor opened this issue Jul 3, 2024 · 4 comments
Open

Allow template to be passed via meta argument? #14

TimTaylor opened this issue Jul 3, 2024 · 4 comments

Comments

@TimTaylor
Copy link

TimTaylor commented Jul 3, 2024

Would it be worth allowing a template to be passed via the meta argument of mark? I've not thought too hard about this, and you likely have good reason for the current implementation, but I wonder if this would be a nice intermediate step between the yaml header and the global option approaches.

@yihui
Copy link
Owner

yihui commented Jul 3, 2024

Thanks for the suggestion! Previously I actually had a template argument for mark() but removed it later, since my brain started to hurt when I had three ways to provide templates for mark(). I can reconsider it if you tell me more about your use case. The only use case I can think of is to programmatically generate multiple reports using the same Markdown input with different templates.

@TimTaylor
Copy link
Author

TimTaylor commented Jul 3, 2024

I can reconsider it if you tell me more about your use case.

Mine is a (very) basic static-site generator that walked a directory structure looking for markdown files and associated template files (a single html file for each directory). Hard-coding the template in to the yaml felt repetitive but I can enforce a standard name for the template and reset the global option for each directory. Appreciate you wanting to keep the code simple so please don't feel pressured (it's easy enough for me to make the current set-up work).

Cheers

@yihui
Copy link
Owner

yihui commented Jul 3, 2024

Thanks for the explanation! I'll think more about it. The current overriding mechanism for meta, options, and template is a little messy. That said, occasionally I feel the need for the template argument in mark() by myself, too. I also briefly thought about the case of using different templates for different directories in a website project when I was writing litedown::fuse_site().

@TimTaylor
Copy link
Author

Oh interesting. I should probably explore fuse_site a bit more before continuing down my rabbit hole.

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

No branches or pull requests

2 participants