nimib
nimib copied to clipboard
small addition: possibility to customize the output block
Right now the output of running Nim code is just pasted as normal code. It would be nice to be able to customize it - e.g. add a prefix like "Output:" or add some custom CSS styling.
currently possible adding after nbCode
:
nbBlock.output = "Output: " & nbBlock.output
If you need to use it more than occasionally, you can make your custom block (to be added or included after nbInit
):
template nbMyCode(body: untyped) =
nbCode(body)
nbBlock.output = "Output: " & nbBlock.output
Also very possible to do it with custom css (using mustache partials or a fully custom template).
Keeping this open until I add this as example of customization somewhere in the documentation.
One thing that might be cool to have (by default) is support for colored text that is printed with terminal escape codes. I had to disable colored printing in my code so that all the escape sequences didn't show up in the output tab, but it might be nice to have a transformation that would apply styles to the output using the same color scheme as the syntax highlighting.
yes, it could be something nice to have. In the meantime I have some example of color printing in https://pietroppeter.github.io/nimib/ptest.html (look in the source for spanColor
)
the possibility of customizing code output has been greatly improved with 0.3. Now one would change the partial of nbCode
and it would automatically be applied to all code blocks. Still have to document this.