pietroppeter/nimib

nimib document compilation

Opened this issue Β· 8 comments

I think it would be nice to have a routine to "compile" a nimib document (ie do everything that nbSave does, but instead of writing a file it returns a string of the generated markdown/html). Very simple, here's what I use (for my personal website/blog thingy):

proc compile*(doc: var NbDoc): string =
  doc.nbCollectAllNbJs()

  doc.context.searchDirs(nb.templateDirs)
  doc.context.searchTable(nb.partials)

  return doc.render()

My main use case for this is compiling a lot of nimib documents at once. This is so much more faster than compiling every single file. There are, of course, a myriad of other uses too.

Agree it makes sense to have this part of the process accessible as a standalone, not sure about the name. Ideally in the beginning render was supposed to serve that purpose, then we added additional tasks in nbSave and forgot/dis not care to protect this use case.

How to proceed now is tricky, it might even that the planned big refactoring might give us a hand there (the additional tasks could be default blocks added in some automatic way at the end?), but we are a bit stuck there.

(Start off topic)

In general very happy to see all these activities @neroist πŸ‘ ❀️

With @HugoGranstrom we are due a nimib speaking hours, would you be interested in joining if we organize it?

(Feel free to decline with absolutely no need for explanation, just thought I should offer)

Is the blog public? Link? ☺️

I think this should be easier to do after the refactoring. I want to remember that rendering a nimib document modifies the context and such you can't render the same document twice. After the refactoring we are planning to make all the steps of the rendering much more defined such that the context isn't changed for example, allowing you to render a document using multiple backends for example.

In general very happy to see all these activities @neroist πŸ‘ ❀️

100% agree with this! Thanks @neroist ❀️

Is the blog public? Link? ☺️

The entire blog is in toki pona lol, but its available at https://neroist.github.io/niko.old/! I'm currently in the process in porting it over to HappyX & setting it up with the domain I bought.

In general very happy to see all these activities @neroist πŸ‘ ❀️

100% agree with this! Thanks @neroist ❀️

Thank you both! @HugoGranstrom @pietroppeter ❀️

lipu pona!

mi pali e lipu ni kepeken ilo nimib 🐳

πŸ’›

lipu pona!

mi pali e lipu ni kepeken ilo nimib 🐳

πŸ’›

sina sona e toki pona la pona mute a! πŸ˜†

mi sona lili e toki pona...

...but I do love it πŸ’˜ and I can get help from chatGpt πŸ˜‡