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

nimib document compilation #245

Open
neroist opened this issue Jun 26, 2024 · 8 comments
Open

nimib document compilation #245

neroist opened this issue Jun 26, 2024 · 8 comments

Comments

@neroist
Copy link
Contributor

neroist commented Jun 26, 2024

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.

@pietroppeter
Copy link
Owner

pietroppeter commented Jun 27, 2024

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)

@pietroppeter
Copy link
Owner

Is the blog public? Link? ☺️

@HugoGranstrom
Copy link
Collaborator

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 ❤️

@neroist
Copy link
Contributor Author

neroist commented Jun 29, 2024

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.

@neroist
Copy link
Contributor Author

neroist commented Jun 29, 2024

In general very happy to see all these activities @neroist 👏 ❤️

100% agree with this! Thanks @neroist ❤️

Thank you both! @HugoGranstrom @pietroppeter ❤️

@pietroppeter
Copy link
Owner

lipu pona!

mi pali e lipu ni kepeken ilo nimib 🐳

💛

@neroist
Copy link
Contributor Author

neroist commented Jun 29, 2024

lipu pona!

mi pali e lipu ni kepeken ilo nimib 🐳

💛

sina sona e toki pona la pona mute a! 😆

@pietroppeter
Copy link
Owner

mi sona lili e toki pona...

...but I do love it 💘 and I can get help from chatGpt 😇

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

3 participants