ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Ipynb Preview as Markdown

A Sublime Text plugin to preview a .ipynb file in Markdown.

Details

Installs

  • Total 539
  • Win 276
  • Mac 168
  • Linux 95
Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21
Windows 0 0 0 0 1 0 1 1 0 0 0 0 0 1 2 2 0 1 3 1 1 0 0 4 5 2 0 1 0 1 0 0 0 0 2 0 1 0 0 1 1 1 2 2 2 4
Mac 0 0 1 0 0 0 1 0 0 0 0 0 1 1 0 1 1 2 0 0 0 0 0 2 1 2 0 0 0 1 1 0 1 1 2 2 1 0 1 0 0 4 1 3 0 2
Linux 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0

Readme

Source
raw.​githubusercontent.​com

Ipynb Preview as Markdown

Ipynb Preview as Markdown is a plugin for Sublime Text that enables users to view .ipynb (Jupyter Notebook) files as Markdown directly within the editor. This plugin provides a convenient way to preview notebook files without leaving Sublime Text, displaying the Markdown, source code, and output cells in a readable format.

Features

Below is an overview of the capabilities integrated into this plugin:

  • Selective Cell Omission: Users have the flexibility to exclude specific cells from the final Markdown document. This includes the ability to omit cells containing source code, those that display outputs following execution, or both.

  • Image Handling Enhancements: To address the limitations of Base64 encoded images within notebooks, this tool automatically converts these images into references to temporary files. This approach not only makes the document more readable but also facilitates easier manipulation and sharing of the generated Markdown files.

  • Absolute Image Paths in Markdown Cells: For Markdown cells that include references to local images, the tool automatically replaces the original path with an absolute path. This adjustment ensures that images are correctly rendered when using document conversion plugins like Pandoc.

  • Language Preservation for Source Code Cells: In recognition of the diverse programming languages that can be used within notebooks, this tool maintains the original language specified for code cells in the notebook when converting to Markdown. This commitment to preserving the source language ensures that the syntax highlighting and other language-specific features remain intact in the final document, providing a seamless transition from notebook to Markdown format.

Installation

“Ipynb Preview as Markdown” can be installed either manually or via Package Control, the convenient package manager for Sublime Text.

Option 1: Install Using Package Control (Recommended)

  1. Install Package Control: If you haven't already, follow the installation instructions to install Package Control.
  2. Open Command Palette: Use Shift+Ctrl+P on Windows/Linux or Cmd+Shift+P on macOS to open the Command Palette.
  3. Install Package: Type Package Control: Install Package and press Enter.
  4. Find and Install: Search for “Ipynb Preview as Markdown” in the list, then press Enter to install it.
  5. Restart Sublime Text: Ensure the plugin is properly loaded.

Option 2: Manual Installation

  1. Download the Plugin: Clone this repository or download the ZIP file and extract it.
  2. Locate Sublime Text Packages Directory:
    • On Windows, the path is usually C:\Users\<Your Username>\AppData\Roaming\Sublime Text 3\Packages\
    • On macOS, the path is usually /Users/<Your Username>/Library/Application Support/Sublime Text 3/Packages/
    • On Linux, the path is usually ~/.config/sublime-text-3/Packages/
  3. Install the Plugin: Copy the plugin directory (containing ipynb_viewer.py and Default.sublime-commands files) into the Sublime Text Packages directory.
  4. Restart Sublime Text: This ensures the plugin is loaded and ready to use.

Usage

To use the “Ipynb Preview as Markdown” plugin:

  1. Open a .ipynb file in Sublime Text.
  2. Open the Command Palette using Shift+Ctrl+P (or Cmd+Shift+P on macOS).
  3. Type Preview ipynb as Markdown and select the command when it appears.
  4. A new window will open with the Markdown preview, showing all the types of cell (Markdown, Source code, or Result). The preview is read-only and cannot be edited.
  5. Type instead Preview ipynb as Markdown (No output) to ommit the cells with results in the preview.
  6. Type instead Preview ipynb as Markdown (No code) to ommit the cells with source code in the preview.
  7. Type instead Preview ipynb as Markdown (No code, No output) to show only the Markdown cells in the preview.

License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2024 Valentin Barral

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.