DonJayamanne / typescript-notebook

Run JavaScript and TypeScript in node.js within VS Code notebooks with excellent support for debugging, tensorflowjs visulizations, plotly, danfojs, etc
https://marketplace.visualstudio.com/items?itemName=donjayamanne.typescript-notebook
MIT License
913 stars 41 forks source link

Support plain text *.js & *.ts files for opening notebooks #32

Open DonJayamanne opened 3 years ago

DonJayamanne commented 3 years ago

I.e. use plain text files as backing store.

RandomFractals commented 3 years ago

would this allows us to open those files as a notebook? i.e. similar to how there are some tools to convert .py scripts to .ipynb and back?

DonJayamanne commented 3 years ago

Yes

mgielda commented 2 years ago

(firstly let me congratulate on the awesome project! glad to see the feature I was planning to ask about was already on the tracker :))

This would definitely be awesome, it's so much easier to store JS files in git etc. So essentially we'd need something like jupytext but for js.

How do you assess the relative complexity of achieving this?

DonJayamanne commented 2 years ago

How do you assess the relative complexity of achieving this?

Not really following your question here. Right now there's no concept of cells in JS files. Basically i'd consider treating any line that starts with // %% as a cell (following from Jupyter) And from there split all of those into separate cells.

Now that we have a way to parse JS files, we would need to create a notebook serializer that would do this translation in both directions. That should be fairly easy.