<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Jupyter Blog - publishing</title><link href="https://jasongrout.github.io/medium-archive/pelican/" rel="alternate"/><link href="https://jasongrout.github.io/medium-archive/pelican/feeds/tag-publishing.atom.xml" rel="self"/><id>https://jasongrout.github.io/medium-archive/pelican/</id><updated>2026-03-26T15:10:00+00:00</updated><subtitle>The Project Jupyter blog: news, releases, and community stories, archived from blog.jupyter.org.</subtitle><entry><title>What’s New in MyST Markdown 1.8.2</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2026/whats-new-in-myst-markdown-1-8-2/" rel="alternate"/><published>2026-03-26T15:10:00+00:00</published><updated>2026-03-26T15:10:00+00:00</updated><author><name>Jupyter Book</name></author><id>tag:jasongrout.github.io,2026-03-26:/medium-archive/pelican/posts/2026/whats-new-in-myst-markdown-1-8-2/</id><summary type="html">&lt;p&gt;The Jupyter Book team just released mystmd 1.8.2 and a new version of the MyST react theme! Below are a few things that stand out.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;The Jupyter Book team just released &lt;strong&gt;mystmd 1.8.2&lt;/strong&gt; and a new version of the MyST react theme! Below are a few things that stand out.&lt;/p&gt;
&lt;h2 id="interactive-widgets-with-the-anywidget-directive"&gt;Interactive widgets with the &lt;code&gt;{anywidget}&lt;/code&gt; directive&lt;/h2&gt;
&lt;p&gt;You can now &lt;a href="https://mystmd.org/guide/widgets"&gt;embed JavaScript widgets&lt;/a&gt; in your MyST pages using the new &lt;code&gt;{anywidget}&lt;/code&gt; directive. Widgets follow the &lt;a href="https://anywidget.dev/"&gt;anywidget specification&lt;/a&gt;, which gives plugin authors an extension point for embedding JS capabilities in their documents.&lt;/p&gt;
&lt;p&gt;A widget is a JavaScript module that exports a &lt;code&gt;render&lt;/code&gt; function. You pass it initial state as JSON in the directive body, and it renders an interactive element on the page. You could use this for interactive figures, explorable explanations, or custom visualizations without leaving MyST.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="A little confetti demo that we use to show off embedding widgets in a MyST document with anywidget!" src="https://jasongrout.github.io/medium-archive/pelican/posts/2026/whats-new-in-myst-markdown-1-8-2/images/001-0_lkUWCUNKiKhXcUUK.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;A little confetti demo that we use to show off embedding widgets in a MyST document with anywidget!&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/em&gt;*: Widget support is experimental. The interfaces may change as we learn more about usage patterns. Only load widgets from sources you trust, since they execute JavaScript in the reader’s browser!*&lt;/p&gt;
&lt;h2 id="table-of-contents-improvements"&gt;Table of contents improvements&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;{toc}&lt;/code&gt; directive now supports a &lt;a href="https://github.com/jupyter-book/mystmd/pull/2705"&gt;&lt;code&gt;children&lt;/code&gt; context option&lt;/a&gt;, which lets you display only the child pages of the current page rather than the full project table of contents. Use it on landing pages and index pages that introduce a section and link to its sub-pages. You can see an example in the &lt;a href="https://jupyterbook.org/latest/get-started/"&gt;Jupyter Book getting started guide&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="better-link-handling-across-multi-site-projects"&gt;Better link handling across multi-site projects&lt;/h2&gt;
&lt;p&gt;If your project spans multiple domains (e.g., a docs site and a blog), you can now &lt;a href="https://github.com/jupyter-book/myst-theme/pull/816"&gt;configure a domain to be treated as “internal”&lt;/a&gt; for link styling. Links to that domain will look like in-site navigation instead of external links. Check out &lt;a href="https://jupyterbook.org/latest/get-started"&gt;the Getting Started guide&lt;/a&gt; for an example.&lt;/p&gt;
&lt;h2 id="upgrade"&gt;Upgrade&lt;/h2&gt;
&lt;p&gt;To get the latest version of mystmd:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;mystmd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or for pip users:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nx"&gt;pip&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;U&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;mystmd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The theme updates automatically. Delete your &lt;code&gt;_build&lt;/code&gt; folder and mystmd will download the latest theme on your next build.&lt;/p&gt;
&lt;h2 id="changelogs"&gt;Changelogs&lt;/h2&gt;
&lt;p&gt;Find an ongoing list of releases in the Jupyter Book ecosystem here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://jupyterbook.org/releases"&gt;jupyterbook.org/releases&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can also read the original &lt;a href="https://github.com/jupyter-book/mystmd/releases/tag/mystmd%401.8.2"&gt;mystmd release notes&lt;/a&gt; and &lt;a href="https://github.com/jupyter-book/myst-theme/releases/tag/myst-to-react%401.1.4"&gt;myst-theme release notes&lt;/a&gt;.&lt;/p&gt;
</content><category term="MyST"/><category term="publishing"/></entry><entry><title>The templating system of nbconvert 6</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/" rel="alternate"/><published>2020-09-26T07:31:00+00:00</published><updated>2020-09-26T08:20:00+00:00</updated><author><name>Sylvain Corlay</name></author><id>tag:jasongrout.github.io,2020-09-26:/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/</id><summary type="html">&lt;p&gt;One of the main changes in nbconvert 6 is the refactor of the template system, which should be easier to extend and build upon.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;One of the main changes in nbconvert 6 is the refactor of the template system, which should be easier to extend and build upon.&lt;/p&gt;
&lt;p&gt;In this article, we dive into the template system, and provide a tutorial on how to build a custom template for &lt;a href="https://github.com/jupyter/nbconvert"&gt;nbconvert&lt;/a&gt; or &lt;a href="https://github.com/voila-dashboards/voila"&gt;Voilà&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="from-classic-to-lab"&gt;From Classic to Lab&lt;/h2&gt;
&lt;h3 id="my-notebooks-look-different"&gt;My notebooks look different!&lt;/h3&gt;
&lt;p&gt;If you are accustomed to convert notebook files to HTML by typing&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupyter nbconvert notebook.ipynb --to html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;you may have noticed differences in the generated HTML when switching to the latest release of nbconvert. In fact, nbconvert now produces the same DOM structure as &lt;strong&gt;JupyterLab’s&lt;/strong&gt; notebook implementation, which is styled with JupyterLab’s CSS.&lt;/p&gt;
&lt;p&gt;One can even apply the &lt;strong&gt;dark theme&lt;/strong&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupyter nbconvert xleaflet.ipynb --to html --HTMLExporter.theme=dark
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;img alt="The HTML output of nbconvert with the lab template and the dark theme" src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/images/001-1_9EeevFjz59QjiqAU9L3P-Q.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The &lt;strong&gt;HTML&lt;/strong&gt; output of nbconvert with the &lt;strong&gt;lab template&lt;/strong&gt; and the &lt;strong&gt;dark theme&lt;/strong&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;While JupyterLab uses CodeMirror to render code cells, nbconvert makes use of the &lt;a href="https://pygments.org/"&gt;&lt;strong&gt;Pygments&lt;/strong&gt;&lt;/a&gt; library to produce syntax-colored static HTML. To mimick the JupyterLab CodeMirror styling, we created a Pygments theme called &lt;a href="https://github.com/jupyterlab/jupyterlab_pygments"&gt;&lt;strong&gt;jupyterlab-pygments&lt;/strong&gt;&lt;/a&gt;. JupyterLab Pygments uses JupyterLab’s CSS variables for coloring and will therefore reflect the theme that is applied to the notebook.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; at the moment, only the default &lt;em&gt;&lt;strong&gt;light&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;dark&lt;/strong&gt;&lt;/em&gt; themes are supported, but we plan on adding support for third-party JupyterLab themes after the release of JupyterLab 3, which introduces a new packaging system for extensions.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id="but-i-wanted-my-notebooks-to-look-the-same"&gt;But I wanted my notebooks to look the same!&lt;/h3&gt;
&lt;p&gt;Well, if you want to retain the classic notebook styling that was used in earlier versions of CSS, it is still possible using the &lt;strong&gt;classic&lt;/strong&gt; template.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupyter nbconvert xleaflet.ipynb --to html --template classic
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;img alt="The HTML output of nbconvert with the classic template" src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/images/002-1_Bn333mVpbD3zu7iqWXH4hA.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The &lt;strong&gt;HTML&lt;/strong&gt; output of nbconvert with the &lt;strong&gt;classic&lt;/strong&gt; &lt;strong&gt;template&lt;/strong&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;With this template, you retrieve the original style of nbconvert outputs and of the classic notebook.&lt;/p&gt;
&lt;p&gt;Another perk of the new nbconvert release is the &lt;strong&gt;WebPDF&lt;/strong&gt; exporter. The WebPDF exporter supports the same templates and themes as the HTML exporter, and produces a PDF output that renders the same rich content as the HTML exporter, such as rich HTML tables, widgets etc.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupyter nbconvert xleaflet.ipynb --to webpdf --HTMLExporter.theme=dark
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;img alt="The WebPDF output of nbconvert with the lab template and the dark theme" src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/images/003-1_82urGQO9ya4D_IMTNQtyWw.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The &lt;strong&gt;WebPDF&lt;/strong&gt; output of nbconvert with the &lt;strong&gt;lab template&lt;/strong&gt; and the &lt;strong&gt;dark theme&lt;/strong&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="executing-the-notebook-before-rendering"&gt;Executing the notebook before rendering&lt;/h3&gt;
&lt;p&gt;Nbconvert’s two main categories of transformations are &lt;em&gt;&lt;strong&gt;preprocessors&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;exporters&lt;/strong&gt;&lt;/em&gt;. Preprocessors take a notebook as an input, and return a transformed notebook, while exporters return other types of content, such as HTML or PDF. An important preprocessor is the &lt;strong&gt;ExecutePreprocessor&lt;/strong&gt;, which spawns a kernel for the notebook, execute all cells, and populate outputs.&lt;/p&gt;
&lt;p&gt;It can be invoked before the export by passing &lt;code&gt;--execute&lt;/code&gt;. For example, the &lt;code&gt;xleaflet.ipynb&lt;/code&gt; notebook uses the &lt;a href="https://github.com/jupyter-xeus/xeus-cling"&gt;xeus-cling&lt;/a&gt; C++ kernel and makes use of the &lt;a href="https://github.com/jupyter-xeus/xleaflet"&gt;xleaflet&lt;/a&gt; interactive widget, which can be displayed when converting to HTML or with the WebPDF exporter.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupyter nbconvert xleaflet.ipynb --to html --execute
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;img alt="The HTML output of nbconvert with the execute preprocessor" src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/images/004-1_YmZfT8M_0wGCq9Ir8jYa6Q.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The &lt;strong&gt;HTML&lt;/strong&gt; output of nbconvert with the &lt;strong&gt;execute preprocessor&lt;/strong&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Similarly, the &lt;strong&gt;WebPDF&lt;/strong&gt; exporter will also display interactive widgets!&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="The PDF output of nbconvert with the execute preprocessor" src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/images/005-1_nrUKm5eexRd9ReMergNnEw.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The &lt;strong&gt;PDF&lt;/strong&gt; output of nbconvert with the &lt;strong&gt;execute preprocessor&lt;/strong&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Future plans for the WebPDF exporter include offering more options to users with respect to &lt;strong&gt;page breaks&lt;/strong&gt;, and providing &lt;strong&gt;bookmarks&lt;/strong&gt; for the main sections of the document.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="nbconvert-templates"&gt;Nbconvert templates&lt;/h2&gt;
&lt;p&gt;Unlike with earlier versions of nbconvert, templates are now &lt;strong&gt;directories&lt;/strong&gt;, which may contain a &lt;strong&gt;jinja&lt;/strong&gt; template but also other assets, such as macros, CSS files etc. The nbconvert template system also provides an inherittance mechanism which makes it simple to tweak existing templates in a derived one, by overriding bits of it.&lt;/p&gt;
&lt;h3 id="selecting-a-template"&gt;Selecting a template&lt;/h3&gt;
&lt;p&gt;Most exporters in nbconvert are subclasses of &lt;a href="https://nbconvert.readthedocs.io/en/latest/api/exporters.html#nbconvert.exporters.TemplateExporter"&gt;&lt;strong&gt;&lt;code&gt;TemplateExporter&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt;, and make use of jinja to render notebooks into the destination format. Nbconvert templates can be selected by name with the &lt;code&gt;--template&lt;/code&gt; command line option.&lt;/p&gt;
&lt;p&gt;For example, the &lt;code&gt;reveal&lt;/code&gt; template, shipped with nbconvert, turns Jupyter notebooks into HTML &lt;strong&gt;slideshows&lt;/strong&gt; using the RevealJS library. Which cells should be skipped, or where breaks betweens slides should be, are specified in the notebook cell &lt;strong&gt;metadata&lt;/strong&gt;. The classic notebook and JupyterLab both provide means to set the appropriate values.&lt;/p&gt;
&lt;p&gt;To select the reveal template, simply type:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupyter nbconvert &amp;lt;path-to-notebook&amp;gt; --to html --template reveal
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the case of the &lt;code&gt;xleaflet.ipynb&lt;/code&gt; notebook showed earlier, we get:&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Creating a reveal slideshow with the dark theme" src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/images/006-1_qXvACe6siMh8a2IfB2JDZw.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Creating a reveal &lt;strong&gt;slideshow&lt;/strong&gt; with the dark theme&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;This demonstrates that the nbconvert templating system can be used to completely override how we look at notebook documents. Using metadata, we can even create arbitrary layouts and rich views of the same content.&lt;/p&gt;
&lt;h3 id="where-are-nbconvert-templates-installed"&gt;Where are nbconvert templates installed?&lt;/h3&gt;
&lt;p&gt;Nbconvert 6 templates are &lt;strong&gt;directories&lt;/strong&gt; containing resources such as &lt;strong&gt;jinja&lt;/strong&gt; templates and other assets. They are installed in the data directory of nbconvert, namely &lt;code&gt;&amp;lt;installation prefix&amp;gt;/share/jupyter/nbconvert&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Running &lt;code&gt;jupyter --paths&lt;/code&gt; shows all Jupyter directories and search paths. For example, on Linux, &lt;code&gt;jupyter --paths&lt;/code&gt; returns:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;jupyter&lt;span class="w"&gt; &lt;/span&gt;--paths
config:
&lt;span class="w"&gt;    &lt;/span&gt;/home/&amp;lt;username&amp;gt;/.jupyter
&lt;span class="w"&gt;    &lt;/span&gt;/&amp;lt;sys-prefix&amp;gt;/etc/jupyter
&lt;span class="w"&gt;    &lt;/span&gt;/usr/local/etc/jupyter
&lt;span class="w"&gt;    &lt;/span&gt;/etc/jupyter
data:
&lt;span class="w"&gt;    &lt;/span&gt;/home/&amp;lt;username&amp;gt;/.local/share/jupyter
&lt;span class="w"&gt;    &lt;/span&gt;/&amp;lt;sys-prefix&amp;gt;/share/jupyter
&lt;span class="w"&gt;    &lt;/span&gt;/usr/local/share/jupyter
&lt;span class="w"&gt;    &lt;/span&gt;/usr/share/jupyter
runtime:
&lt;span class="w"&gt;    &lt;/span&gt;/home/&amp;lt;username&amp;gt;/.local/share/jupyter/runtime
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In our case, only the &lt;strong&gt;data&lt;/strong&gt; section is relevant. Listing the content of &lt;code&gt;&amp;lt;sys-prefix&amp;gt;/share/jupyter/nbconvert/templates&lt;/code&gt; in a raw installation of nbconvert will show&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;ls&lt;span class="w"&gt; &lt;/span&gt;&amp;lt;sys-prefix&amp;gt;/share/jupyter/nbconvert/templates
asciidoc&lt;span class="w"&gt; &lt;/span&gt;base&lt;span class="w"&gt; &lt;/span&gt;classic&lt;span class="w"&gt; &lt;/span&gt;compatibility&lt;span class="w"&gt; &lt;/span&gt;html&lt;span class="w"&gt; &lt;/span&gt;lab&lt;span class="w"&gt; &lt;/span&gt;latex&lt;span class="w"&gt; &lt;/span&gt;markdown&lt;span class="w"&gt; &lt;/span&gt;python&lt;span class="w"&gt; &lt;/span&gt;reveal&lt;span class="w"&gt; &lt;/span&gt;rst&lt;span class="w"&gt; &lt;/span&gt;script
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;base&lt;/code&gt; template should not be used directly, but is typically inherited from. The&lt;code&gt;compatibility&lt;/code&gt; directory provides some content for backward compatibility with earlier verions of nbconvert. Three templates are available for the HTML exporter: &lt;code&gt;lab&lt;/code&gt;, &lt;code&gt;classic&lt;/code&gt;, and &lt;code&gt;reveal&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="the-content-of-nbconvert-templates"&gt;The content of nbconvert templates&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;The &lt;code&gt;conf.json&lt;/code&gt; file&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Nbconvert templates all include a &lt;strong&gt;conf.json&lt;/strong&gt; file used to indicate the base template that it is inheriting from, the mimetype corresponding to that template (which determines which exporters are compatible with it, and which file is the entry point), and preprocessors to run when using that template before running the exporter. For example, inspecting the configuration of the &lt;code&gt;reveal&lt;/code&gt; template we see that&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;it inherits from the &lt;code&gt;lab&lt;/code&gt; template,&lt;/li&gt;
&lt;li&gt;exports &lt;code&gt;text/html&lt;/code&gt;, and therefore will only work with the HTML and WebPDF exporters.&lt;/li&gt;
&lt;li&gt;and runs two preprocessors called &lt;code&gt;100-pygments&lt;/code&gt; and &lt;code&gt;500-reveal:&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;base_template&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;lab&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;mimetypes&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;text/html&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;true&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;preprocessors&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;100-pygments&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;type&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;type&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;nbconvert.preprocessors.CSSHTMLHeaderPreprocessor&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;enabled&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;true&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;500-reveal&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;type&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;nbconvert.exporters.slides._RevealMetadataPreprocessor&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;enabled&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;true&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;CSSHTMLHeaderPreprocessor&lt;/code&gt; inlines the CSS required for the syntax highlighting of input cells.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;RevealMetadataPreprocessor&lt;/code&gt; massages the notebook metadata and consumes the information required to set up the layout of the slideshow.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nbconvert walks up the inheritance structure determined by &lt;code&gt;conf.json&lt;/code&gt; and produces an agregated configuration, merging the dictionaries of registered preprocessors. The ordering of the preprocessor names determines the order in which they will be run.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Jinja templates&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Besides the &lt;code&gt;conf.json&lt;/code&gt; file, nbconvert templates most typically include jinja templates files. They may also override files from the base templates, or provide extra content.&lt;/p&gt;
&lt;p&gt;For example, inspecting the content of the &lt;code&gt;classic&lt;/code&gt; template located in &lt;code&gt;share/jupyter/nbconvert/templates/classic&lt;/code&gt;, we find the following content:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;share/jupyter/nbconvert/templates/classic
├── static
│   └── styles.css
├── conf.json
├── index.html.j2
└── base.html.j2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;we see that it includes the &lt;code&gt;index.html.j2&lt;/code&gt; jinja template (which is the main entry point for HTML exporters) as well as CSS and a base template file in &lt;code&gt;base.html.j2&lt;/code&gt;. The only preprocessor listed in &lt;code&gt;conf.json&lt;/code&gt; is the pygments syntax highlighting…&lt;/p&gt;
&lt;h3 id="inheritance-in-jinja"&gt;Inheritance in Jinja&lt;/h3&gt;
&lt;p&gt;In nbconvert, jinja templates can inherit from any other jinja template available in its current directory or base template directory by name. Jinja templates of other directories can be addressed by their path from the Jupyter data directory. Using the path is also useful when using a jinja template that may be overriden locally.&lt;/p&gt;
&lt;p&gt;For example, in the reveal template, &lt;code&gt;index.html.j2&lt;/code&gt; extends &lt;code&gt;base.html.j2&lt;/code&gt; which is in the same directory, and &lt;code&gt;base.html.j2&lt;/code&gt; extends &lt;code&gt;lab/base.html.j2&lt;/code&gt;. This approach allows using content that is available in other templates or may be overriden in the current template.&lt;/p&gt;
&lt;h2 id="building-a-custom-template"&gt;Building a custom template&lt;/h2&gt;
&lt;p&gt;Now, let’s create a custom template! If you work at ACME Corporation, you may want to create a template that follows the graphical charter of ACME Corp, and includes the logo in a banner.&lt;/p&gt;
&lt;p&gt;Besides the logo, titles should also use the “&lt;a href="https://fonts.google.com/specimen/Acme"&gt;ACME Regular&lt;/a&gt;” font, which has a cartoon-style look. The other parts of the template are inherited from the regular lab template.&lt;/p&gt;
&lt;p&gt;Setting up a logo banner, and the font change, the &lt;code&gt;acme&lt;/code&gt; nbconvert template produces the following result with a very simple notebook:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupyter nbconvert acme.ipynb --to html --template acme
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;img alt="The HTML output of nbconvert with the acme template" src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/images/007-1_jhxkC7lv5SFirR-xfQJpsA.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The &lt;strong&gt;HTML&lt;/strong&gt; output of nbconvert with the &lt;strong&gt;acme template&lt;/strong&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Now you can create sophisticated templates making use of sophisticated front-end framework and processing the notebook metadata in creative ways!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The source for the ACME nbconvert template is available&lt;/em&gt; &lt;a href="https://github.com/SylvainCorlay/nbconvert-acme/."&gt;&lt;em&gt;here&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;br&gt;
Beyond the template files in &lt;code&gt;share/jupyter/nbconvert/acme&lt;/code&gt;, the repo provides the logic for packaging this template into a PyPI wheel with data files. You will also find content related to the use of that template with Voilà, which is the subject of the next section.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="from-nbconvert-templates-to-voila-templates"&gt;From nbconvert templates to Voilà templates&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/images/008-1_BTJSFb_pQ8TSVwc6bPgjbA.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/voila-dashboards/voila"&gt;&lt;strong&gt;Voilà&lt;/strong&gt;&lt;/a&gt; turns Jupyter notebooks into standalone web applications and &lt;strong&gt;dashboards&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;It differs from nbconvert in that the output web application is connected to a Jupyter kernel, allowing it to respond to user input through widget controls and other UI components, while with nbconvert, any action that requires a roundtrip to the kernel will not work.&lt;/p&gt;
&lt;p&gt;However, &lt;strong&gt;Voilà leverages the nbconvert template system&lt;/strong&gt; to benefit from their flexibility in overriding the front-end looks and behavior. From a user standpoint, the system is made so that the same templates will be usable for both systems.&lt;/p&gt;
&lt;p&gt;However, template authors interested in advanced features of Voilà may be interested in the following information.&lt;/p&gt;
&lt;h3 id="where-are-voila-templates-installed"&gt;Where are Voilà templates installed?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Voilà templates are installed in the &lt;code&gt;&amp;lt;installation prefix&amp;gt;/share/jupyter/voila&lt;/code&gt; directory (while nbconvert templates are in &lt;code&gt;&amp;lt;installation prefix&amp;gt;/share/jupyter/nbconvert&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Just like nbconvert templates, Voilà templates are directories, they use the same &lt;code&gt;conf.json&lt;/code&gt; configuration mechanism.&lt;/li&gt;
&lt;li&gt;Voilà can use nbconvert HTML templates without modification.&lt;/li&gt;
&lt;li&gt;When there exists an nbconvert and a Voilà template of the same name, the conf.json files are recursively merged, as well as the content of the directory, with a higher precedence for the Voilà template.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="overriding-nbconvert-templates-with-voila"&gt;Overriding nbconvert templates with Voilà&lt;/h3&gt;
&lt;p&gt;When specifying the &lt;code&gt;acme&lt;/code&gt; template that we developed earlier, with command&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;voila xleaflet.ipynb --template acme
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Voilà will look pick up the acme nbconvert template. Since this template inherits from lab and Voilà has an overridden lab template (with e.g. the logic for rendering widgets), it will pick up the Voilà flavor of the lab template. Most typically, the Voilà flavor of a template does not add much on top of nbconvert besides boilerplate such as&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a call to the macro that includes the &lt;strong&gt;JavaScript assets&lt;/strong&gt; for the Voilà front-end logic.&lt;/li&gt;
&lt;li&gt;calls to macro related to &lt;strong&gt;error logging&lt;/strong&gt; when using the Voilà preview.&lt;/li&gt;
&lt;li&gt;calls to macros related to the &lt;strong&gt;progressive rendering&lt;/strong&gt; of notebooks as it is being executed, and the display of an “in-progress” &lt;strong&gt;spinner&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These macros are provided in the &lt;code&gt;base&lt;/code&gt; Voilà template, and can also be overridden in derived templates.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/the-templating-system-of-nbconvert-6/images/009-1_ey1ie8kpgPMTvHU6nvjKvw.mp4" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;h2 id="future-developments"&gt;Future developments&lt;/h2&gt;
&lt;p&gt;In the coming weeks and months, we plan on polishing the experience of nbconvert users.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;JupyterLab 3, which should be released shortly, includes a more dynamic extension system which does not require the main JupyterLab application to be rebuilt. We plan on adding support for a category of lab extensions called “&lt;strong&gt;mime renderers&lt;/strong&gt;“ which are used for rich rendering of data in cell outputs. This should enable the use of complex mime types such as GeoJSON or Vega visualizations in nbconvert and Voilà.&lt;/li&gt;
&lt;li&gt;We are working on improving the &lt;code&gt;reveal&lt;/code&gt; template, to include a &lt;strong&gt;custom reveal theme&lt;/strong&gt; making use of JupyterLab CSS variables, so that it can be easily combined with JupyterLab themes.&lt;/li&gt;
&lt;li&gt;The JupyterLab 3 extension system may also enable us to enable &lt;strong&gt;third-party JupyterLab themes&lt;/strong&gt; in nbconvert.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;WebPDF&lt;/strong&gt; exporter should expose options on output format and where page breaks should be. At the moment, we prevent page breaks until the maximum dimensions of PDF documents are reached.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="acknowledgements"&gt;Acknowledgements&lt;/h2&gt;
&lt;p&gt;Many people were involved in the nbconvert 6 release! The full list of contributors is available &lt;a href="https://nbconvert.readthedocs.io/en/latest/changelog.html#id7"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Among them, we are especially indebted to &lt;a href="https://twitter.com/maartenbreddels"&gt;&lt;strong&gt;Maarten Breddels&lt;/strong&gt;&lt;/a&gt;, who was the main architect of the new template system.&lt;/li&gt;
&lt;li&gt;We owe the split of the execute preprocessor and the new &lt;strong&gt;nbclient&lt;/strong&gt; package to &lt;a href="https://twitter.com/codeseal"&gt;&lt;strong&gt;Matthew Seal&lt;/strong&gt;&lt;/a&gt; and &lt;a href="https://twitter.com/davidbrochart"&gt;&lt;strong&gt;David Brochart&lt;/strong&gt;&lt;/a&gt;. Matthew took on a large amount of maintenance work on the project over the past year.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The work on Voilà and nbconvert by the QuantStack team was funded by &lt;a href="https://www.techatbloomberg.com/"&gt;Bloomberg&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="about-the-author"&gt;About the Author&lt;/h2&gt;
&lt;p&gt;Sylvain Corlay is the CEO of &lt;a href="https://twitter.com/QuantStack"&gt;QuantStack&lt;/a&gt;, an open-source software development team specialized scientific computing comprising maintainers of major projects of the ecosystem.&lt;/p&gt;
&lt;p&gt;As an open-source developer, Sylvain is mostly active in the Jupyter ecosystem, and the general PyData stack. He is currently a steering committee member for Project Jupyter, and a member of the board of directors of NumFOCUS.&lt;/p&gt;
</content><category term="publishing"/></entry><entry><title>Announcing the new Jupyter Book</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2020/announcing-the-new-jupyter-book/" rel="alternate"/><published>2020-08-12T19:55:00+00:00</published><updated>2020-08-12T20:07:00+00:00</updated><author><name>Chris Holdgraf</name></author><id>tag:jasongrout.github.io,2020-08-12:/medium-archive/pelican/posts/2020/announcing-the-new-jupyter-book/</id><summary type="html">&lt;p&gt;Note: this announcement is cross-posted between the Jupyter Blog and the Executable Book Project updates blog&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;em&gt;Note: this announcement is cross-posted between the&lt;/em&gt; &lt;a href="https://blog.jupyter.org/"&gt;&lt;em&gt;Jupyter Blog&lt;/em&gt;&lt;/a&gt; &lt;em&gt;and the&lt;/em&gt; &lt;a href="https://executablebooks.org/en/latest/updates/index.html"&gt;&lt;em&gt;Executable Book Project updates blog&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/announcing-the-new-jupyter-book/images/001-1_7SNQTEdxo9qTuEpR-yUNZQ.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;Jupyter Book is an open source project for building beautiful, publication-quality books, websites, and documents from source material that contains computational content. With this post, we’re happy to announce that Jupyter Book has been re-written from the ground up, making it easier to install, faster to use, and able to create more complex publishing content in your books. It is now supported by &lt;a href="https://executablebooks.org/en/latest/"&gt;the Executable Book Project&lt;/a&gt;, an open community that builds open source tools for interactive and executable documents in the Jupyter ecosystem and beyond.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="The new Jupyter Book interface, highlighting how you can insert code outputs into your content" src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/announcing-the-new-jupyter-book/images/002-0_ExwTAlNcaJadUOkS.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The new Jupyter Book interface, highlighting how you can &lt;a href="https://jupyterbook.org/content/glue.html"&gt;insert code outputs into your content&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;This post is a short overview of the new features in Jupyter Book, and gives some background on the future of the project.&lt;/p&gt;
&lt;p&gt;You can also browse the &lt;a href="https://jupyterbook.org/"&gt;new Jupyter Book documentation&lt;/a&gt;, or &lt;a href="https://github.com/executablebooks/jupyter-book"&gt;check out the Jupyter Book GitHub repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;❗❗ Jupyter Book is still in beta, so things are always changing. We’d love your feedback, ideas, and PRs for how to make the project better!❗❗&lt;/p&gt;
&lt;h2 id="what-does-the-new-jupyter-book-do"&gt;What does the new Jupyter Book do?&lt;/h2&gt;
&lt;p&gt;The new version of Jupyter Book will feel very similar. However, it has a lot of new features due to the new Jupyter Book stack underneath (more on that later).&lt;/p&gt;
&lt;p&gt;The new Jupyter Book has the following main features (with links to the relevant documentation for each):&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;✅&lt;/strong&gt; &lt;a href="https://jupyterbook.org/content-types/markdown"&gt;&lt;strong&gt;Write publication-quality content in markdown&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
You can write in either Jupyter markdown, or an extended flavor of markdown with &lt;a href="https://jupyterbook.org/content/myst"&gt;publishing features&lt;/a&gt;. This includes support for rich syntax such as &lt;a href="https://jupyterbook.org/content/citations"&gt;citations and cross-references&lt;/a&gt;, &lt;a href="https://jupyterbook.org/content/math"&gt;math and equations&lt;/a&gt;, and &lt;a href="https://jupyterbook.org/content/figures"&gt;figures&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;✅&lt;/strong&gt; &lt;a href="https://jupyterbook.org/content-types/notebooks"&gt;&lt;strong&gt;Write content in Jupyter Notebooks&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
This allows you to include your code and outputs in your book. You can also write notebooks &lt;a href="https://jupyterbook.org/content-types/myst-notebooks"&gt;entirely in markdown&lt;/a&gt; to execute when you build your book.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;✅&lt;/strong&gt; &lt;a href="https://jupyterbook.org/content/execute"&gt;&lt;strong&gt;Execute and cache your book’s content&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
For &lt;code&gt;.ipynb&lt;/code&gt; and markdown notebooks, execute code and insert the latest outputs into your book. In addition, &lt;a href="https://jupyterbook.org/content/execute.html#cacheing-the-notebook-execution"&gt;cache and re-use&lt;/a&gt; outputs to be used later.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;✅&lt;/strong&gt; &lt;a href="https://jupyterbook.org/content/glue"&gt;&lt;strong&gt;Insert notebook outputs into your content&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
Generate outputs as you build your documentation, and insert them in-line with your content across pages.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;✅&lt;/strong&gt; &lt;a href="https://jupyterbook.org/interactive/launchbuttons"&gt;&lt;strong&gt;Add interactivity to your book&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
You can &lt;a href="https://jupyterbook.org/interactive/hiding"&gt;toggle cell visibility&lt;/a&gt;, include &lt;a href="https://jupyterbook.org/interactive/interactive"&gt;interactive outputs&lt;/a&gt; from Jupyter, and &lt;a href="https://jupyterbook.org/interactive/launchbuttons"&gt;connect with online services&lt;/a&gt; like Binder.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;✅&lt;/strong&gt; &lt;a href="https://jupyterbook.org/start/build"&gt;&lt;strong&gt;Generate a variety of outputs&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
This includes single- and multi-page websites, as well as &lt;a href="https://jupyterbook.org/advanced/pdf"&gt;PDF outputs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;✅&lt;/strong&gt; &lt;a href="https://jupyterbook.org/reference/cli"&gt;&lt;strong&gt;Build books with a simple command-line interface&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
You can quickly generate your books with one command, like so: &lt;code&gt;jupyter-book build mybook/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;These are just a few of the major changes that we’ve made. For a more complete idea of what you can do, &lt;a href="https://jupyterbook.org/"&gt;check out the Jupyter Book documentation&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="major-changes"&gt;Major changes&lt;/h2&gt;
&lt;p&gt;In the next few sections we’ll talk about some major changes that you may notice in Jupyter Book.&lt;/p&gt;
&lt;h3 id="an-enhanced-flavor-of-markdown"&gt;An enhanced flavor of markdown&lt;/h3&gt;
&lt;p&gt;The biggest enhancement to Jupyter Book is support for the &lt;a href="https://myst-parser.readthedocs.io/en/latest/"&gt;MyST Markdown language&lt;/a&gt;. MyST stands for “Markedly Structured Text”, and is a flavor of markdown that implements all of the features of the &lt;a href="https://www.sphinx-doc.org/"&gt;Sphinx documentation engine&lt;/a&gt;, allowing you to write scientific publications in markdown. It draws inspiration from RMarkdown and the reStructuredText ecosystem of tools. Anything you can do in Sphinx, you can do with MyST as well.&lt;/p&gt;
&lt;p&gt;MyST Markdown is a &lt;em&gt;superset&lt;/em&gt; of Jupyter Markdown (AKA, CommonMark), meaning that &lt;em&gt;any default markdown in a Jupyter Notebook is valid in Jupyter Book&lt;/em&gt;. If you’d like extra features in markdown such as citations, figures, references, etc, then you may include extra MyST Markdown syntax in your content.&lt;/p&gt;
&lt;p&gt;For example, here’s how you can &lt;a href="https://jupyterbook.org/content/citations.html"&gt;include a citation&lt;/a&gt; in the new Jupyter Book:&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="A sample citation. Here we see how you can include citation syntax in-line with your markdown, and then insert a bibliography later on in your page." src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/announcing-the-new-jupyter-book/images/003-0_SSmfD6zf7vpQHYy3.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;A sample citation. Here we see how you can include citation syntax in-line with your markdown, and then insert a bibliography later on in your page.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;And here’s how you can include a figure:&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="A sample figure. Here we see how you can insert a figure with a caption into your book, and control some aspects of how the figure is displayed with options." src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/announcing-the-new-jupyter-book/images/004-0_yKc7ku6ENbclkhg1.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;A sample figure. Here we see how you can insert a figure with a caption into your book, and control some aspects of how the figure is displayed with options.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="a-smarter-build-system"&gt;A smarter build system&lt;/h3&gt;
&lt;p&gt;While the old version of Jupyter Book used a combination of Python and Jekyll to build your book’s HTML, the new Jupyter Book uses Python all the way through. This means that building the HTML for your book is as simple as:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupyter-book build mybookname/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In addition, the new build system leverages &lt;a href="https://jupyter-cache.readthedocs.io/"&gt;Jupyter Cache&lt;/a&gt; to execute notebook content &lt;em&gt;only if the code is updated&lt;/em&gt;, and to insert the outputs from the cache at build time. This saves you time by avoiding the need to re-execute code that hasn’t been changed.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="An example build process. Here the jupyter-book command-line interface is used to convert a collection of content into an HTML book." src="https://jasongrout.github.io/medium-archive/pelican/posts/2020/announcing-the-new-jupyter-book/images/005-0_-5xZV1SW6nA4ARWx.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;An example build process. Here the &lt;code&gt;jupyter-book&lt;/code&gt; command-line interface is used to convert a collection of content into an HTML book.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="more-book-output-types"&gt;More book output types&lt;/h3&gt;
&lt;p&gt;By leveraging Sphinx, Jupyter Book will be able to support more complex outputs than &lt;em&gt;just&lt;/em&gt; an HTML website. For example, we are currently prototyping &lt;a href="https://jupyterbook.org/advanced/pdf.html"&gt;PDF Outputs&lt;/a&gt;, both via HTML as well as via LaTeX. This gives Jupyter Book more flexibility to generate the right book for your use case.&lt;/p&gt;
&lt;p&gt;You can also run Jupyter Book on &lt;a href="https://jupyterbook.org/start/build.html#build-a-standalone-page"&gt;individual pages&lt;/a&gt;. This means that you can write single-page content (like a scientific article) entirely in Markdown.&lt;/p&gt;
&lt;h3 id="a-new-stack"&gt;A new stack&lt;/h3&gt;
&lt;p&gt;The biggest change under-the-hood is that Jupyter Book now uses &lt;a href="https://www.sphinx-doc.org/en/master/"&gt;the Sphinx documentation engine&lt;/a&gt; instead of Jekyll for building books. By leveraging the Sphinx ecosystem, Jupyter Book can more effectively build on top of community tools, and can contribute components back to the broader community.&lt;/p&gt;
&lt;p&gt;Instead of being a single repository, the old Jupyter Book repository has now been separated into several modular tools. &lt;strong&gt;Each of these tools can be used on their own in your Sphinx documentation&lt;/strong&gt;, and they can be coordinated together &lt;em&gt;via&lt;/em&gt; Jupyter Book:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://myst-parser.readthedocs.io/en/latest/"&gt;&lt;strong&gt;The MyST markdown parser for Sphinx&lt;/strong&gt;&lt;/a&gt; allows you to write fully-featured Sphinx documentation in Markdown.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://myst-nb.readthedocs.io/en/latest/"&gt;&lt;strong&gt;MyST-NB&lt;/strong&gt;&lt;/a&gt; is an &lt;code&gt;.ipynb&lt;/code&gt; parser for Sphinx that allows you to use MyST Markdown in your notebooks. It also provides tools for execution, cacheing, and variable insertion of Jupyter Notebooks in Sphinx.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sphinx-book-theme.readthedocs.io/"&gt;&lt;strong&gt;The Sphinx Book Theme&lt;/strong&gt;&lt;/a&gt; is a beautiful book-like theme for Sphinx, build on top of the &lt;a href="https://pydata-sphinx-theme.readthedocs.io/en/latest/"&gt;PyData Sphinx Theme&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jupyter-cache.readthedocs.io/en/latest/"&gt;&lt;strong&gt;Jupyter Cache&lt;/strong&gt;&lt;/a&gt; allows you to execute a collection of notebooks and store their outputs in a hashed database. This lets you cache your notebook’s output without including it in the &lt;code&gt;.ipynb&lt;/code&gt; file itself.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sphinx-thebe.readthedocs.io/en/latest/"&gt;&lt;strong&gt;Sphinx-Thebe&lt;/strong&gt;&lt;/a&gt; converts your “static” HTML page into an interactive page with code cells that are run remotely by a Binder kernel.&lt;/li&gt;
&lt;li&gt;Finally, Jupyter Book also supports a growing &lt;strong&gt;collection of Sphinx extensions&lt;/strong&gt;, such as &lt;a href="https://sphinx-copybutton.readthedocs.io/en/latest/"&gt;sphinx-copybutton&lt;/a&gt;, &lt;a href="https://sphinx-togglebutton.readthedocs.io/"&gt;sphinx-togglebutton&lt;/a&gt;, &lt;a href="https://sphinx-comments.readthedocs.io/en/latest/"&gt;sphinx-comments&lt;/a&gt;, and &lt;a href="https://sphinx-panels.readthedocs.io/en/latest/?badge=latest"&gt;sphinx-panels&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We’ll write a more developer-focused post in the future to describe each of these components in more detail.&lt;/p&gt;
&lt;h2 id="what-next"&gt;What next?&lt;/h2&gt;
&lt;p&gt;Jupyter Book and its related projects will continue to be developed as a part of the &lt;a href="https://executablebooks.org/"&gt;Executable Book Project&lt;/a&gt;, a community that builds open source tools for high-quality scientific publications from computational content in the Jupyter ecosystem and beyond.&lt;/p&gt;
&lt;p&gt;If you’d like to learn more about Jupyter Book or get started building your own books, then check out &lt;a href="https://jupyterbook.org/"&gt;the new Jupyter Book documentation&lt;/a&gt;. Jupyter Book is still in beta and is constantly being improved, so your &lt;a href="https://github.com/executablebooks/jupyter-book/issues/new/choose"&gt;feedback and contributions are always welcome&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If there are particular features you’d like to see, open an issue or give a 👍 to a pre-existing issue, and &lt;a href="https://executablebooks.org/en/latest/feature-vote.html"&gt;it will be bumped up on the feature request leaderboard&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="get-involved"&gt;Get involved&lt;/h2&gt;
&lt;p&gt;If you’d like to contribute to any of the projects listed in this post, you are highly encouraged to do so! The Executable Book Project (and thus Jupyter Book) is run as an open project that &lt;a href="https://executablebooks.org/en/latest/contributing.html"&gt;welcomes contributions from others&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We are excited about all the new features and improvements in the new Jupyter Book, and look forward to seeing the new books that the community creates with this stack!&lt;/p&gt;
</content><category term="Jupyter Book"/><category term="publishing"/></entry><entry><title>Rendering Notebooks on GitHub</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2015/rendering-notebooks-on-github/" rel="alternate"/><published>2015-05-07T19:47:00+00:00</published><updated>2017-08-28T20:08:00+00:00</updated><author><name>Project Jupyter</name></author><id>tag:jasongrout.github.io,2015-05-07:/medium-archive/pelican/posts/2015/rendering-notebooks-on-github/</id><summary type="html">&lt;p&gt;We are pleased to announce that, starting today, and as announced on the GitHub blog, Jupyter/IPython notebook (.ipynb) files will render directly on GitHub. This …&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2015/rendering-notebooks-on-github/images/001-1_Edn_LpbSpLeNKfWkEdG2Jg.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;We are pleased to announce that, starting today, and as announced on &lt;a href="https://github.com/blog/1995-github-jupyter-notebooks-3"&gt;the GitHub blog&lt;/a&gt;, Jupyter/IPython notebook (&lt;code&gt;.ipynb&lt;/code&gt;) files will render directly on GitHub. This feature works for notebooks in any of the supported Jupyter &lt;a href="https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages"&gt;programming languages&lt;/a&gt; on both public and private repos. This capability will complement &lt;a href="https://nbviewer.jupyter.org"&gt;nbviewer&lt;/a&gt; and make it easier for GitHub users to create, view and share notebooks on GitHub.&lt;/p&gt;
&lt;p&gt;Here are some great examples of notebook based content that can now be viewed directly on GitHub:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cameron Davidson-Pilon’s &lt;a href="https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter1_Introduction/Chapter1.ipynb"&gt;Probabilistic Programming and Bayesian Methods for Hackers&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Lorena Barba’s &lt;a href="https://github.com/barbagroup/AeroPython/blob/master/lessons/01_Lesson01_sourceSink.ipynb"&gt;Aerodynamics-Hydrodynamics with Python&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Benjamin Laken’s &lt;a href="https://github.com/benlaken/Comment_BadruddinAslam2014/blob/master/Monsoon_analysis.ipynb"&gt;Monsoon Analysis&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We want to thank the GitHub team for bringing this new feature to GitHub. In particular &lt;a href="https://github.com/tclem"&gt;@tclem&lt;/a&gt;, &lt;a href="https://github.com/arfon"&gt;@arfon&lt;/a&gt;, &lt;a href="https://github.com/sshirokov"&gt;@sshirokov&lt;/a&gt;, and &lt;a href="https://github.com/skalnik"&gt;@skalnik&lt;/a&gt; have all done an incredible job building this at GitHub. The first discussion of how to bring notebook rendering to GitHub happened almost 18 months ago, and a lot of work made this feature possible today. With over &lt;a href="https://github.com/search?l=&amp;amp;q=nbformat+extension%3Aipynb&amp;amp;ref=advsearch&amp;amp;type=Code&amp;amp;utf8=%E2%9C%93"&gt;200,000 notebooks&lt;/a&gt; available on GitHub, you already have a lot to read!&lt;/p&gt;
&lt;p&gt;We are excited to see how this feature will impact science education and research on GitHub, as well as encourage the adoption of the Jupyter notebook as a standard file format across a wide range of fields. Jupyter notebook files are a JSON-based open document format that supports code and results, narrative text, images, and equations in one file. These documents simplify the creation and communication of computational narratives and make the sharing and replication of scientific results and data analyses simpler.&lt;/p&gt;
&lt;h3 id="nbviewer"&gt;nbviewer&lt;/h3&gt;
&lt;p&gt;One key piece of infrastructure in sharing notebooks has been the &lt;a href="http://nbviewer.org"&gt;nbviewer&lt;/a&gt; service, which started as a side project of mine in the late summer of 2012. Nbviewer has grown through deep integration with GitHub, with the ability to browse all public users, organizations, repositories, branches, tags, and even Gists. This would not have been possible without &lt;a href="https://github.com/rgbkrk"&gt;@rgbkrk&lt;/a&gt; and &lt;a href="https://github.com/bollwyvl"&gt;@bollwyvl&lt;/a&gt;, who handle the development and deployment of nbviewer. It would also not have been possible without &lt;a href="https://developer.rackspace.com/"&gt;Rackspace&lt;/a&gt; and &lt;a href="http://www.fastly.com/"&gt;Fastly&lt;/a&gt;, who provide free hosting and fast static asset distribution. Nbviewer has steadily grown to render hundreds of thousands of notebooks every week, and usage is still increasing. Based on this, we believe that rendering on GitHub will be a highly used and appreciated feature.&lt;/p&gt;
&lt;p&gt;Although you can now view notebooks directly on GitHub, we are not planning to stop the development of nbviewer. While rendering directly in GitHub repositories is convenient and allows viewing notebooks in private repositories, there are number of reasons that nbviewer will continue to remain an important part of project Jupyter.&lt;/p&gt;
&lt;p&gt;First, there are many notebooks not hosted on GitHub. As before, these notebooks can still be viewed on nbviewer. Furthermore, the Jupyter/IPython team are actively working on improving integration with other content providers, building on our experience with GitHub. For example, a recent pull request of &lt;a href="https://github.com/jupyter/nbviewer/pull/443"&gt;@bollwyvl&lt;/a&gt; streamlines the process of adding new providers to nbviewer, with &lt;a href="https://github.com/jupyter/nbviewer/issues?q=is%3Aopen+is%3Aissue+label%3Aprovider"&gt;proposals&lt;/a&gt; for DropBox, GitLab, Google Drive, Stash, and other hosting and collaboration platforms.&lt;/p&gt;
&lt;p&gt;Second, because of security concerns, some features available on nbviewer will not be available on GitHub. For example, GitHub will not render any dynamic output display that uses JavaScript, custom CSS, and most custom HTML embedded in Markdown or in outputs. When this is the case, and GitHub cannot fully render your notebooks, you will see an icon that allows you to view the full notebook on nbviewer.&lt;/p&gt;
&lt;p&gt;Because nbviewer does not handle authentication, it will continue to support custom CSS, HTML and JavaScript in notebook. Thus, for highly customized or dynamic notebooks, nbviewer will still be the ideal place to share them.&lt;/p&gt;
&lt;p&gt;We would love your feedback! If you have comments or find bugs with notebook rendering on GitHub or nbviewer, please open an issue on our &lt;a href="https://github.com/jupyter/nbviewer"&gt;nbviewer repo&lt;/a&gt;. Also, please send a few tweets to thank all the people without whom this would have not happened.&lt;/p&gt;
&lt;p&gt;The Jupyter/IPython Team&lt;/p&gt;
</content><category term="GitHub"/><category term="nbviewer"/><category term="publishing"/></entry></feed>