Skip to content

Instantly share code, notes, and snippets.

@grst
Last active October 16, 2019 09:32
Show Gist options
  • Save grst/201546299eafa91b268fb7828dbbb12f to your computer and use it in GitHub Desktop.
Save grst/201546299eafa91b268fb7828dbbb12f to your computer and use it in GitHub Desktop.
pandoc toc from ipynb example files
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>test</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<div class="cell markdown">
<h1 id="test-heading-1">Test Heading 1</h1>
<h2 id="test-heading-11">Test Heading 1.1</h2>
<p>Lorem ipsum...</p>
<h2 id="test-heading-12">Test Heading 1.2</h2>
<p>Lorem ipsum...</p>
</div>
<div class="cell markdown">
<h1 id="test-heading-2">Test Heading 2</h1>
<p>Lorem ipsum</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>test</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<nav id="TOC" role="doc-toc">
<ul>
<li><a href="#test-heading-1">Test Heading 1</a><ul>
<li><a href="#test-heading-1.1">Test Heading 1.1</a></li>
<li><a href="#test-heading-1.2">Test Heading 1.2</a></li>
</ul></li>
<li><a href="#test-heading-2">Test Heading 2</a></li>
</ul>
</nav>
<h1 id="test-heading-1">Test Heading 1</h1>
<h2 id="test-heading-1.1">Test Heading 1.1</h2>
<p>Lorem ipsum…</p>
<h2 id="test-heading-1.2">Test Heading 1.2</h2>
<p>Lorem ipsum…</p>
<h1 id="test-heading-2">Test Heading 2</h1>
<p>Lorem ipsum</p>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test Heading 1\n",
"## Test Heading 1.1\n",
"Lorem ipsum...\n",
"\n",
"## Test Heading 1.2\n",
"Lorem ipsum...\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"# Test Heading 2\n",
"Lorem ipsum"
]
}
],
"metadata": {
"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.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

Test Heading 1

Test Heading 1.1

Lorem ipsum...

Test Heading 1.2

Lorem ipsum...

Test Heading 2

Lorem ipsum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment