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

Add option for displaying (non-editable) source code below rendered output #12

Open
asg017 opened this issue May 2, 2021 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@asg017
Copy link
Owner

asg017 commented May 2, 2021

dataflow run just executes the notebook, it doesn't display the source code like observablehq does.

A new option, --display-source, can be added to signal to dataflow that source code should be showed alongside the rendered output, so people can learn more/inspect the code if they want to learn more.

For example, this is example.ojs

// example.ojs

// @dataflow show
chart = {
  const canvas = DOM.canvas(width, 640);
  const ctx = canvas.getContext("2d");
  ctx.rect(0, 0, 100, 100);
  return canvas;
}

dataflow run example.ojs --display-source would then have show this in its rendered output:

+----------------------+
|    the canvas element  |
+----------------------+
+----------------------+
|       the source code     |
+----------------------+

instead of:

+----------------------+
|    the canvas element  |
+----------------------+
+----------------------+
|       the source code     |
+----------------------+

Something like a // @dataflow show could be used to "pin" cells to enable this on a cell-by-cell basis.

This would not be available in dataflow compile.

@asg017 asg017 added this to the v1 milestone May 2, 2021
@asg017 asg017 added the enhancement New feature or request label May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant