nimibook icon indicating copy to clipboard operation
nimibook copied to clipboard

Allow embedding a nim file as an nbCode block

Open PhilippMDoerner opened this issue 9 months ago • 18 comments

This came to me while writing on the owlkettle nimibook.

Owlkettle has a bunch of example.nim files for example applications for individual widgets. I would love to be able to embed those inside of the owlkettle nimibook instead of linking to the files.

The idea would be something like:

import nimib, nimibook

nbInit(theme = useNimibook)

nbText: """
## Example
Look at this very cool example of a scale widget
"""

nbCode(file = "owlkettle/examples/widget/scale.nim")

nbText: """
As you can see it does wonderful things etc. etc.
"""
...

This is just an example to demonstrate what I mean, what the Syntax for it looks like exactly isn't all that important.

PhilippMDoerner avatar Oct 03 '23 09:10 PhilippMDoerner