Skip to content

Commit

Permalink
Merge pull request #35 from kirbs-/dev
Browse files Browse the repository at this point in the history
0.4.0 Release
  • Loading branch information
kirbs- committed Feb 26, 2017
2 parents 9f0943c + 8632ed8 commit 04126c9
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 114 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ python:
- "pypy"
# command to install dependencies
install:
# force six to install first as it's a dependicy of simplegeneric and simplegeneric is erroring.
- pip install six
- pip install jupyter
- pip install pdfkit
- pip install -e .
# command to run tests
script:
- python -c 'import hide_code.hide_code as hc; hc.install()'
- jupyter nbextension install --py hide_code --sys-prefix
- jupyter nbextension enable --py hide_code --sys-prefix
- jupyter serverextension enable --py hide_code --sys-prefix
74 changes: 13 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,27 @@
# Hide_code
![PyPI version](https://badge.fury.io/py/hide_code.svg) ![MIT license](https://img.shields.io/github/license/mashape/apistatus.svg)

Release: ![Travis release build](https://travis-ci.org/kirbs-/hide_code.svg?branch=master) Dev: ![Dev Build Status](https://travis-ci.org/kirbs-/hide_code.svg?branch=dev)

## 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](/images/button.png)

Normal
![image1.1](/images/1.1.png)

Hide Code Enabled
![image1.2](/images/1.2.png)

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](/images/2.png)

Normal
![image3.1](/images/3.1.png)

Hide Code Enabled
![image3.2](/images/3.2.png)

## 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](http://wkhtmltopdf.org/)!**
* **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](/images/4.1.png)

### 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`
hide_code is a Jupyter notebook extension to selectively hide code, prompts and outputs with PDF and HTML exporting support.

![demo](/images/demo.gif)

## Installation
### Via pip
`pip install hide_code`
1. `pip install hide_code`
2. `jupyter nbextension install --py hide_code`
3. `jupyter nbextension enable --py hide_code`
4. `jupyter serverextension enable --py hide_code`

Note: add `--sys-prefix` to `jupyter nbextension` to install into virtualenv or conda environment.

### Via setuptools
1. Download and unzip this repository.
2. Change to unzipped directory.
3. Execute ```python setup.py install```
## Upgrading from 0.3.1?
Versions prior to 0.4 were installed by bootstrapping custom.js and jupyter configuration files. Pip uninstall does not remove these files. Upgrade to 0.4, then run `python -c "import hide_code; hide_code.uninstall_bootrapped_files()"`.

### 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.
```python
import hide_code.hide_code as hc
dir = "<full path to Jupyter config directory>"
hc.install(dir)
```
## Documentation
Visit the [Wiki](https://github.com/kirbs-/hide_code/wiki).

## Requirements
* Jupyter notebook 4.x+
* Jupyter nbconvert 4.2+ if using nbconvert command line exporting
* Jupyter nbconvert ~>4.2+ if using nbconvert command line exporting. nbconvert 5.x does not work with hide_code.
* pdfkit & [wkhtmltopdf](http://wkhtmltopdf.org/)
* Python 2.7 or 3.3+
3 changes: 2 additions & 1 deletion hide_code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
from .hide_code_preprocessor import HideCodePreprocessor
from .hide_code import *
from .hide_code_config import HideCodeConfig
from .utils import Utils
from .utils import Utils
from .hide_code import _jupyter_nbextension_paths, _jupyter_server_extension_paths
Loading

0 comments on commit 04126c9

Please sign in to comment.