-
Notifications
You must be signed in to change notification settings - Fork 10
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
Code shown with nbJsShowSource
is not as in source (but comes from ast)
#154
Comments
Ah right, I opted for not using codeAsInSource for nbJs because of the composability issues. But using it just for the code shown by |
yep, that sounds fine! |
Hmm thinking a bit more about it, I don't think we should do this actually. If the nbJs block is defined in another file, codeAsInSource will not be able to locate it and error, which is bad. The error is because codeAsInSource only looks in the current file. The problem is that the current way we are doing this is to mark the block as So the solution imo is to just do a nimibCode:
nbJsFromCode:
# Comment
echo "Hello world"
# vs
nbJsFromCode:
# Comment
echo "Hello world"
nbJsShowSource() |
yeah, I guess you are right, it complicates stuff too much. So, now I am thinking, should we remove (with a deprecation period) |
I agree, |
mmh, in p5nim I am not sure I want to use template nbJsFromCodeDisplay*(args: varargs[untyped]):
newNbCodeBlock("nbJsFromCodeDisplay", args[^1]):
discard
nbJsFromCode(args) I would then need to add partials and renderPlan as in nbCode. |
Yeah, if we are going to support it, this seems like the easiest way 👍 |
an even easier way that generalizes to other templates (restricted to template with single body argument, but you should always be able to wrap a more complex template in one with a single body argument) implement with nbCodeDisplay in #158 |
I am using
nbJsShowSource
for showing p5js examples (see e.g. https://pietroppeter.github.io/nim-p5/polygons.html).The code comes from ast instead of being read from source, with all classical problems (no comments and weird indents).
The text was updated successfully, but these errors were encountered: