-
Notifications
You must be signed in to change notification settings - Fork 297
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
Support for editing Plain text files (like Python, MyST and R Markdown-based) as notebooks #1237
Comments
This would almost work out of the box. I believe the only changes would be to:
If you wanted to do this in a separate extension, we'd need an extensibility point for submitting code to the python extension (which you could add to our extension with a PR against us too) |
oh awesome. I'm more than happy to have this as a part of this existing extension. I know that the starting delimiters are:
Let me know if there's anything I can do to help |
If you're willing to add a PR, I believe we'd love to accept it. You'd have to expand our code that figures out cell ranges and add those regexes to our searching. I think after that it would just work. (Might be some things that check for .py - like debugging). |
If you're uncomfortable with a PR, it would likely take a bunch of other people up voting the idea for us to get to it. |
We're happy to help point out where to add changes to our code though. |
@rchiodo, that would be very helpful and i will try to take a stab at it. I was wading through the codebase but some pointers would be welcome |
First I think you'd go here to change the file extensions we provide code lenses for: You'd change that PYTHON_ALLFILES to be something else that included your markdown file types. Then you'd likely change the default regex defined in package.json (and I think in the source too somewhere) so that it included the patterns you specified above. You'll likely have to add another setting for 'end' cell markers or something Then finally you'd have to change our logic that finds cell ranges. The crux of that is here: Right now it assumes the next begin marker is the end of the previous cell. Obviously you'll have to handle the case where your end marker is there too. Hope that helps. Feel free to submit a draft PR if you want to ask us more questions when you get farther. |
Hi, unfortunately I don't think I will have time to take this on myself but I think this would be a great improvement to notebook ergonomics in vscode. |
If this could happen at some point, that would be really awesome. One idea I had for HTML export is to expand it to prompt the user to pick either a static file or a jupyter book. For example if I choose jupyter book, it opens a GUI prompt to specify traits of the book and then creates the html pages. Could incorporate Github pages with this as well |
for visibility, it looks like the quarto vscode extension now supports its version of markdown, qmd (quarto-dev/quarto-cli#149). I think a similar pattern could be used for the code execution part for other markdown files. looks like there's a related PR (#4876) to generalize the markdown within the standard vscode library |
Moving suggestion from #10174 as recommended by @DonJayamanne There are a number of already-existing formats that can convert from/to ipynb, implemented as ContentManagers for jupyter. They augment loading/saving process with on-the-fly conversion between filetypes. While it could be of high value to implement the same for vs code, currently custom NotebookSerializers should provide conversion vscode <> custom format. This requires a lot of logic that is specific to vs code, and requires copying a good chunk of code and dependencies from vs code. (see #10174 and #10121) Proposal below should simplify support for custom formats by reusing existing converters between ipynb and custom formats. I suggest that default vscode NotebookSerializer for ipynb could be provided with a following triple:
For instance, when saving a file, extension will convert to ipynb, then use a corresponding conversion. Another possibility is even simpler, in this case work with FS is offloaded to hooks:
While Edited on Oct 26: typo and added a link to one more discussion; added an alternative suggestion on hooks |
I'd like to +1 here We have been using (jupytext-powered) text-based notebooks for quite some time now, Using jupyter classic notebook mainly, so together with jupytext I've been trying to use the vscode-jupytext extension for a while, but this clearly needs more work, so I ended up here following @DonJayamanne's post in that repo How can we help ? |
Duplicate of #1240 |
Recently I've been using jupyter-book as one of my primary notebook environments. It's built on top of MyST, which is a flavor of markdown that is compatible with reStructuredText, and they've built an extension for syntax support.
I really love the integration VSCode has for executing
#%%
cells in python scripts with and general cells in Jupyter Notebooks. I am wondering if it would be of interest to support other cell paradigms like the ``` code chunk delimiter one in jupyter-book, which is also shared in RMarkdown.If it's a not feature that fits the roadmap, could you make a suggestion how I might be able to build off what is currently there and support it as an extension?
Thanks a bunch! I really love this product
The text was updated successfully, but these errors were encountered: