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 101
  • Win 44
  • Mac 39
  • Linux 18
Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13
Windows 1 2 2 1 2 1 0 2 2 0 1 1 0 0 0 3 3 0 0 1 0 1 0 1 0 0 2 1 0 2 3 1 0 1 0 0 0 0 3 1 1 0 1 1 1 0
Mac 0 0 2 0 2 0 0 0 0 0 0 2 4 0 0 3 1 1 3 1 1 0 1 1 0 1 1 0 2 2 0 0 0 0 2 0 2 1 1 0 2 0 0 0 1 1
Linux 1 0 0 0 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 1 0 2 1 1 0 0 2 0 0 1 0 0 1 0 0 1 0 0 0 0 1 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.