Open cittadhammo opened 1 month ago
I just saw that you can have an extra file like: myTemplate.typ
than you can import in your main.typ as a function with:
#import "myTemplate.typ": myTemplateFunction
#show: myTemplateFunction
Then, it would make even more sense to have a straight conversion of the mdbook content with the two-liner only on top. You could poor all your setting into that template and not have to worry about it.
Then you only need something like:
[output.typst]
template = "myTemplate.typ"
function = "myTemplateFunction"
I think this would be the best option, having a simple conversion in typst with your script and then adding on the side a template.typ that apply the style you want (with some default one, the same that you have entered the script)
Like this, there would be no styling in the script, no toc, no custom heading for part, etc. just a plain workable typst file with a template file that we can custom and keep. The script could ask for generating a default template or use an existing one. In my case, that would be perfect, because I update my content, so I have to run the script, but once the template is OK, I don't want to touch it any more.
I like the idea of a template file!
Did you see that there is an advanced section where you can put a raw typist header and footer? https://github.com/LegNeato/mdbook-typst/blob/ffebc48eb46db225dc32912c0f87ec2fa217be73/src/config.rs#L119C1-L123C20
I actually saw in the code that there was this option to add to the book.toml
But for me, it is much easier to have a custom template that stores all my styles, so this is why I wanted to have an option to strip down the style from the output and only have the include template name
at the top.
Yeah, I think that is a much better method for people that are typst native. I'll look at cleaning up and integrating you PR, thanks for it!
I thought it would be nice to have more options available in the
book.toml
to allow before building, likeYou can see my discussion of how to do this.
Also, I have some custom code I put at the begging of my typst file as a sort of template, like:
I know you could create specific keys in the TOML file above. but this would only cover so much options (and need to be coded by hand). Rather, we could have a key that contain custom instructions to be put in the front matter of the typst file like: