only set the display and view builtins in js and ts cells#172
Conversation
mbostock
left a comment
There was a problem hiding this comment.
Great. 👍 I just don’t like the name displayBuiltins for the option… let me think some more but maybe send candidates my way, thank you.
| ? transpileJavaScript(transpileTemplate(cell), options) | ||
| : transpileJavaScript(input, options); | ||
| if (transpiled.output === undefined) transpiled.output = cell.output; | ||
| if (mode === "js" || mode === "ts") transpiled.displayBuiltins = true; |
There was a problem hiding this comment.
Strange to override the user’s setting based on mode. Did you want to provide a default for displayBuiltins instead, like displayBuiltins = mode === "ojs"? Also I think the logic is inverted in that we just want to suppress for ojs, not that we want to suppress for everything except js and ts.
There was a problem hiding this comment.
My point in inverting the logic is that in other cells (like md, html), these builtins don't work anyway? But either way is fine.
Words: displaycallbacks, celldisplay, stdout, printer
There was a problem hiding this comment.
I think they do work, they just display another thing (apart from whatever the template cell evaluates too). But that’s a pretty obscure application of display, and if we allow view and display in template cells then you wouldn’t be able to embed another cell of that name… so you probably had it right the first time! I’ll take another look tonight.
mbostock
left a comment
There was a problem hiding this comment.
This doesn’t need to be part of transpile and TranspiledJavaScript, given that it corresponds directly to the passed-in mode and is not depend on the source code in any way; it can just be an option that is passed in to define. I’ll simplify.
This allows to support a symbol created in
ojswith the nameviewordisplay:I figured it would also be cleaner to not have
viewordisplayin the HTML, md, and tex cells, where they don't work.