docs/example.ipynb
{
"cells": [
{
"cell_type": "raw",
"id": "2d153021-ebd6-44b3-8fd4-f255233b7a83",
"metadata": {},
"source": [
"---\n",
"author: Kolen Cheung\n",
"title: Pandoc filter for ipynb\n",
"description: This will becomes pandoc's meta-block.\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "fc4e8ae7-9d4d-42a4-a880-d5e5d9e11d2f",
"metadata": {},
"source": [
"# Example\n",
"\n",
"An example with some markdown texts.\n",
"\n",
"Compare `source </example>`{.interpreted-text role=\"doc\"} and `output </example-output>`{.interpreted-text role=\"doc\"}.\n",
"\n",
"Below we'll write some Python code that will becomes invisible after pannb filtering."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "3f02e5f1-d9a7-4645-9d3c-6d2914b2bc70",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"df = pd.DataFrame(np.arange(9).reshape(3, 3))"
]
},
{
"cell_type": "markdown",
"id": "d68cd8b4-a9a1-4b2b-85a3-2fa0c3ad9f35",
"metadata": {},
"source": [
"However, the HTML output of these cells should be visible, and converted to pandoc's internal format.\n",
"\n",
"For example, the below table will be valid in LaTeX output."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "2efe6488-91e7-48d0-86c5-791c594a9340",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0 1 2\n",
"0 0 1 2\n",
"1 3 4 5\n",
"2 6 7 8"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "pannb",
"language": "python",
"name": "pannb"
},
"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.9.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}