A Visual Studio Code extension to easily copy selected Jupyter Notebook cells as a single markdown block and paste markdown back into a notebook as distinct cells.
This extension is designed to streamline the process of sharing notebook content with AI chatbots, documentation platforms, or any markdown-based system. It also helps in quickly bringing structured markdown back into your notebooks.
- Copy Selected Cells as Markdown: Select one or more cells (Code or Markdown) in your Jupyter Notebook. The extension will convert them into a single, well-formatted markdown string and copy it to your clipboard.
- Markdown cells are copied as is.
- Code cells are wrapped in markdown code blocks, preserving their language identifier (e.g.,
```python ... ```
).
- Paste Markdown as Cells: Take a markdown string (formatted with text and code blocks as produced by the copy feature) from your clipboard and paste it into your active Jupyter Notebook. The extension will parse the markdown and create new cells accordingly:
- Plain text becomes Markdown cells.
- Markdown code blocks become Code cells with the appropriate language.
- Open a Jupyter Notebook (
.ipynb
file) in VS Code. - Select one or more cells you wish to copy.
- Right-click on one of the selected cells to open the context menu.
- Choose "Notebook: Copy Selected Cells as Markdown".
- Alternatively, open the Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
) and search for "Notebook: Copy Selected Cells as Markdown".
- Alternatively, open the Command Palette (
- The formatted markdown will be copied to your clipboard. A notification will confirm the action.
- Ensure you have markdown text (formatted as described above, typically from this extension's copy command or a similar structure) on your clipboard.
- Open a Jupyter Notebook (
.ipynb
file) in VS Code. - Click on a cell to select it. The new cells will be pasted below this cell. If no cell is selected, they will be pasted at the end of the notebook.
- Right-click in the notebook area (e.g., on a cell or between cells) to open the context menu.
- Choose "Notebook: Paste Markdown as Cells".
- Alternatively, open the Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
) and search for "Notebook: Paste Markdown as Cells".
- Alternatively, open the Command Palette (
- The markdown from your clipboard will be parsed and inserted as new cells. A notification will confirm if successful, or show an error if the content is not parsable.
A list of language identifiers (e.g. python
, javascript
, r
) that will be turned into Code cells when pasting markdown. Code fences with other languages are pasted as plain Markdown.
Default: ["python"]
- Visual Studio Code version
^1.76.0
or higher. - A working Jupyter Notebook environment if you intend to run the notebooks (the extension itself operates on the
.ipynb
file structure).
- Currently, the parsing for "Paste Markdown as Cells" expects markdown primarily structured by this extension's copy command. Complex or unusually formatted markdown might not parse as expected.
- Error handling for extremely large clipboard content could be improved.
See the CHANGELOG.md for details on each release.
Enjoy using Notebook Markdown Copier!