Coder Social home page Coder Social logo

hide_code's Introduction

Hide_code

PyPI version MIT license

Release: Travis release build Dev: Dev Build Status

Introduction

hide_code is an extension for Jupyter/IPython notebooks to selectively hide code, prompts and outputs. Make a notebook a code free document for presenting with a single click by pressing hide_code toggle

Normal image1.1

Hide Code Enabled image1.2

Or customize each cell by selecting "Hide code" cell Toolbar dropdown. Then use "Hide Code" and "Hide Prompts" checkboxes to hide the specific cell's code or cell's input/output prompts.

image2

Normal image3.1

Hide Code Enabled image3.2

Exporting

Hide_code adds HTML, PDF via HTML, and PDF via Latex export options to Jupyter. Exporting respects hide_code's code, prompt, and output selections; these must be saved prior to exporting.

This feature continues to evolve. Items on the road map incude:

  • saving as a different file name.
  • support for custom CSS.
  • single click exporting with all code and prompts hidden (similar to how the toolbar button).

Notes

  • Exporting to PDF via HTML requires wkhtmltopdf!
  • Exporting to PDF via Latex requires a Tex library.

Via notebook

To export via HTML or PDF simply click on the respective button. image4.1

Via nbconvert command line

To export via nbconvert command line, nbconvert 4.2 or later is required. Hide_code adds three export options to nbconvert, hide_code_html, hide_code_pdf, and hide_code_latexpdf.

Note: PDF exporting via command line uses nbconvert's built in PDF exporter.

jupyter nbconvert --to hide_code_html notebook_to_convert.ipynb

jupyter nbconvert --to hide_code_pdf notebook_to_convert.ipynb

jupyter nbconvert --to hide_code_latexpdf notebook_to_convert.ipynb

Installation

Via pip

pip install hide_code

Via setuptools

  1. Download and unzip this repository.
  2. Change to unzipped directory.
  3. Execute python setup.py install

Installation Troubleshooting

If installation complains the directory doesn't exist, you're Jupyter/IPython installation probably isn't in one of the usual places. Locate Jupyter's configuration directory, then use code below to install in a non-standard directory.

import hide_code.hide_code as hc
dir = "<full path to Jupyter config directory>"
hc.install(dir)

Requirements

  • Jupyter notebook 4.x+
  • Jupyter nbconvert 4.2+ if using nbconvert command line exporting
  • pdfkit & wkhtmltopdf
  • Python 2.7 or 3.3+

hide_code's People

Contributors

kirbs- avatar acspike avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.