{ "cells": [ { "cell_type": "markdown", "metadata": { "nbsphinx": "hidden" }, "source": [ "This notebook is part of the `nbsphinx` documentation: https://nbsphinx.readthedocs.io/." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Raw Cells\n", "\n", "The \"Raw NBConvert\" cell type can be used to render different code formats into HTML or LaTeX by Sphinx. This information is stored in the notebook metadata and converted appropriately.\n", "\n", "## Usage\n", "\n", "To select a desired format from within Jupyter, select the cell containing your special code and choose options from the following dropdown menus: \n", "\n", "1. Select \"Raw NBConvert\"\n", "2. Switch the Cell Toolbar to \"Raw Cell Format\"\n", "3. Chose the appropriate \"Raw NBConvert Format\" within the cell\n", "\n", "![Steps for converting cells to Raw formats in Jupyter](images/raw_cells.png)\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Available Raw Cell Formats\n", "\n", "The following examples show how different Jupyter cell formats are rendered by Sphinx." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### None\n", "\n", "By default (if no cell format is selected), the cell content is included (without any conversion) in both the HTML and LaTeX output.\n", "This is typically not useful at all." ] }, { "cell_type": "raw", "metadata": {}, "source": [ "\"I'm a raw cell with no format.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### reST\n", "\n", "Raw cells in \"reST\" format are interpreted as reStructuredText and parsed by Sphinx. The result is visible in both HTML and LaTeX output. " ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "\"**I'm** a *raw cell* in reST_ format.\"\n", "\n", ".. _reST: https://www.sphinx-doc.org/rest.html" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Markdown\n", "\n", "Raw cells in \"Markdown\" format are interpreted as Markdown, and the result is included in both HTML and LaTeX output. Since the Jupyter Notebook also supports normal Markdown cells, this might not be useful *at all*." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/markdown" }, "source": [ "\"**I'm** a *raw cell* in [Markdown](https://daringfireball.net/projects/markdown/) format.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### HTML\n", "\n", "Raw cells in \"HTML\" format are only visible in HTML output. This option might not be very useful, since raw HTML code is also allowed within normal Markdown cells." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/html" }, "source": [ "

I’m a raw cell in\n", "HTML format.”

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### LaTeX\n", "\n", "Raw cells in \"LaTeX\" format are only visible in LaTeX output." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/latex" }, "source": [ "\\textbf{I'm} a \\emph{raw cell} in \\href{https://www.latex-project.org/}{\\LaTeX} format." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Python\n", "\n", "Raw cells in \"Python\" format are not visible at all (nor executed in any way)." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/x-python" }, "source": [ "print(\"I'm a raw cell in \\\"Python\\\" format!\")" ] } ], "metadata": { "celltoolbar": "Raw Cell Format", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.1+" } }, "nbformat": 4, "nbformat_minor": 1 }