-
Notifications
You must be signed in to change notification settings - Fork 15
Improve templating mechanism #266
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
base: master
Are you sure you want to change the base?
Conversation
absolutely necessary! |
Agreed, this is a lot more streamlined than templating 😅 We shouldn't break the ecosystem more than we already have though. We should probably switch back to the old method, and emit a warning, if we see a Also, is there a way to define that options struct in a different file, so that we can amend it later if we need to? |
we should break it now, that's its early days of 0.2, and only a few are noticing (me included 😄). Otherwise, we will see a potential wave of issues later on. EDIT: |
agreed, earlier breakage is always better than later but isn't this also only breaking for those who've written their own config? For the most casual users shouldn't it be copied from our template? |
yes, this should only affect to those of us having our own |
True, but quite a few users have written their own config.mts :D - if you wanted a manually defined top bar, you have to write your own config, and that's a big draw to DV from regular Documenter. Maybe we can change that now though. e.g. |
Ok but if that's your worry, things already break with updates to this typescript part. For example, my docs build broke when I updated to the version with the |
Using a custom config has always been an option for those that want extra things, and I believe that's well known, hence breaking it with the proper warnings is the way to go, I will definitely keep having my own, and changing, updating when necessary. For those that don't add extra features the default should still work. |
If we have a nice mechanism to feed in from Julia now, then let's go full Julia. Let's make the claim that the config can shift arbitrarily at each patch release. If you want to keep up or pin your version, feel free, but that's on you. But we should make it easy to perform a small subset of changes to config.mts which are easy to do from Julia.
This is then a lot less likely to break. |
Maybe one could actually create the whole argument of |
Some things may require some JS setup code outside the theme dict, but I absolutely agree. We can just have a That's why I was saying we can have multiple angles to attack this. But yeah, we should definitely define the whole thing as a semi-custom JSON...maybe we can add some hooks to e.g. JSON.jl to render a |
It is of course a little more confusing if you paste javascript functions this way that are referencing some variables you assume to be there in the final script. Would be better if they were always completely self-contained but who knows what kind of logic people will come up with. At least one always has the |
Yeah, if you really want type checking, then you can create your own config and accept that you will have to update it occasionally, which seems fine to me. We can also accept package specifications to add to package.json. |
This was a pretty error-prone mechanism where javascript literals were hand-constructed on the Julia side and then some more or less opaque patterns would be overwritten or replaced.
Here, we just define an expectation of the fields we need on the typescript side, so that at least basic linting will work. This doesn't do any validation though, seems not trivial to have some object just be runtime checked, and I don't want to pull in a validation library in this PR.
But then we just build a dict of values on the Julia side and simply write that out using JSON.jl, which avoids all problems with handcrafted literals and removes all the replacement code.
If we want to handle optional values, we just do that on the javascript side instead of removing whole chunks of the template.