Conversation
|
milestone reached, now in sandbox/minib3.nim both a minimal html and json backend work. (your json work was great @HugoGranstrom). Still lots of details to work on, but I am feeling more confident now! A big realization was that in the end we might not need after all nim mustache anymore (we might still provide it for legacy reason and we should be able to provide a somewhat backward compatible NbLegacyDoc object that implements the default theme as before with partials), in a sense nimib itself is some code based (and block based) templating system with superpowers... |
|
(moved this note in sandbox/notes.md) |
Mmh, no to customize an existing block the idea is to replace the function that renders it in the nimib/sandbox/minib3/minib.nim Line 26 in 5e6727e
The part above is still an idea and will need more fleshing out. I would definitely start with bare html and would allow customization only in the sense of: give me the rendered output and I can put things before or after. Any kind of refinement to that idea would need a use case that we think makes it worth it. And I would not probably push this during this refactor, maybe for now we do not even do what is sketched above (just to keep the scope manageable).
Yes, that is an option (serializing also the theme), but I guess it is kind of wasteful and also not "clean". I would like if possible to have a somewhat readable json. Especially if it is a low cost thing and a simple rule such as: everything that is in
Yeah, that is a good observation and it might not be needed after all. In principle you should not remember to set it since it should be in the NbBlock generating sugar, but if we can avoid needing it I could probably remove it. It will get trickier once I introduce real custom container blocks. My idea there at the moment is that Thanks for the feedback on the work-in-progress, it is useful :) nothing here is yet set in stone but I think a cleaner implementation is finally coming out. |
|
note, I just pushed a possible implementation of a NbContainer object (and NbContainer = ref object of NbBlock
blocks: seq[NbBlock]
parent: NbContainerwhile the html backend works fine with it the json backend fails to serialize because of the circular reference. This is an issue with My current plan is to actually skip the |
|
ok the new Next steps:
|
|
Nice work! 🤩 I really like the |
|
notes from another discussion. in this PR we should also:
|
|
So, I've started working on implementing Another thing that I'm wondering about is whether we should do the compilation the same way we are doing it now. Now we do it in |
|
The tests are finally fixed! 🥳 We are so close, now we just need to go through the code and clean it up. One thing I'm thinking about is moving all the block definitions out to other files. Maybe a folder with different blocks in different files? Maybe just a gigantic file with all the blocks? Do you have any preferences? The drawback of putting them in different files would be that we could stumble upon cyclic imports if we want to share stuff between them. |
|
I would probably go with single file with all blocks |
|
Great, then I'll fix that when I get some time over 👌 |
|
That worked out way smoother than I expected. Now I just need to clean up some comments and then we should be ready for a final review. 🥳 |
|
There was less to be done than I thought, so now the PR is officially ready for review @pietroppeter 😉 |
|
Great will give it a go soon enough. You should mark it as non draft |
Review: PR #235 — Refactor NbBlockSummary of Changes1. New wrapper type
|
|
Tried to review with Claude. It does seem it has done a decent job, but now of course, I need to review the review :) |
I'm thinking a bit about this and it doesn't hurt to include these fields in the |
I tried fixing this, but we must have a bigger cycle of imports that I can't seem to find. So I'll keep it as it is for now |
this is a major change, implements #168 (and also #117). Very WIP in a sandbox folder (see sandbox/notes.md)