Search
Demo page to showcase markdown

NOTE: None of the information on this page applies to Jupyter Books.

It is taken from the Markdown documentation, and is meant to give an idea of how Jupyter Book renders really long pages of very diverse content!

Amount of Content

You should be able to put as much content, and as many headings, within each chapter as you want. In order to enable this we allow the table of contents on the right hand side to be scrollable. All of the sections on here allow us to test that. And they'll give you a full guide too all of markdown's awesome features.

The following test is all thanks to @adam-p's great wiki.

Testing Unicode headers

The following headers test that we are able to render non-American characters in ways that look nice.

Це тестовий заголовок Кирилицею

Lorem ipsum

これは日本語のテストヘッダーです

Lorem ipsum

هذا اختبار للرأس باللغة العربية

Lorem ipsum

這是中文標題測試

Markdown Cheatsheet

This is intended as a quick reference and showcase. For more complete info, see John Gruber's original spec and the Github-flavored Markdown info page.

This cheatsheet is specifically Markdown Here's version of Github-flavored Markdown. This differs slightly in styling and syntax from what Github uses, so what you see below might vary a little from what you get in a Markdown Here email, but it should be pretty close.

You can play around with Markdown on our live demo page.

Table of Contents

Headers Emphasis Lists Links Images Code and Syntax Highlighting Tables Blockquotes Inline HTML Horizontal Rule Line Breaks YouTube Videos TeX Mathematical Formulae

Headers

no-highlight
# H1
## H2
### H3
#### H4
##### H5
###### H6

Alternatively, for H1 and H2, an underline-ish style:

Alt-H1
======

Alt-H2
------

H1

H2

H3

H4

H5
H6

Alternatively, for H1 and H2, an underline-ish style:

Alt-H1

Alt-H2

Emphasis

no-highlight
Emphasis, aka italics, with *asterisks* or _underscores_.

Strong emphasis, aka bold, with **asterisks** or __underscores__.

Combined emphasis with **asterisks and _underscores_**.

Strikethrough uses two tildes. ~~Scratch this.~~

Emphasis, aka italics, with asterisks or underscores.

Strong emphasis, aka bold, with asterisks or underscores.

Combined emphasis with asterisks and underscores.

Strikethrough uses two tildes. Scratch this.

Lists

no-highlight
1. First ordered list item
2. Another item
  * Unordered sub-list.
1. Actual numbers don't matter, just that it's a number
  1. Ordered sub-list
4. And another item.

   Some text that should be aligned with the above item.

* Unordered list can use asterisks
- Or minuses
+ Or pluses
  1. First ordered list item
  2. Another item
    • Unordered sub-list.
  3. Actual numbers don't matter, just that it's a number
    1. Ordered sub-list
  4. And another item.

    Some text that should be aligned with the above item.

  • Unordered list can use asterisks
  • Or minuses
  • Or pluses

There are two ways to create links.

no-highlight
[I'm an inline-style link](https://www.google.com)

[I'm a reference-style link][Arbitrary case-insensitive reference text]

[You can use numbers for reference-style link definitions][1]

Or leave it empty and use the [link text itself]

URLs and URLs in angle brackets will automatically get turned into links.
http://www.example.com or <http://www.example.com> and sometimes
example.com (but not on Github, for example).

Some text to show that the reference links can follow later.

[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com

I'm an inline-style link

I'm a reference-style link

You can use numbers for reference-style link definitions

Or leave it empty and use the link text itself

URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or http://www.example.com and sometimes example.com (but not on Github, for example).

Some text to show that the reference links can follow later.

Images

no-highlight
Here's our logo (hover to see the title text):

Inline-style:
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")

Reference-style:
![alt text][logo]

[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"

Here's our logo (hover to see the title text):

Inline-style: alt text

Reference-style: alt text

Code and Syntax Highlighting

Code blocks are part of the Markdown spec, but syntax highlighting isn't. However, many renderers -- like Github's and Markdown Here -- support syntax highlighting. Markdown Here supports highlighting for dozens of languages (and not-really-languages, like diffs and HTTP headers); to see the complete list, and how to write the language names, see the highlight.js demo page.

no-highlight
Inline `code` has `back-ticks around` it.

Inline code has back-ticks around it.

Blocks of code are either fenced by lines with three back-ticks ```, or are indented with four spaces. I recommend only using the fenced code blocks -- they're easier and only they support syntax highlighting.

```javascript
var s = "JavaScript syntax highlighting";
alert(s);
```

```python
s = "Python syntax highlighting"
print s
```

```
No language indicated, so no syntax highlighting.
But let's throw in a <b>tag</b>.
```
var s = "JavaScript syntax highlighting";
alert(s);
s = "Python syntax highlighting"
print s
No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
But let's throw in a <b>tag</b>.

Again, to see what languages are available for highlighting, and how to write those language names, see the highlight.js demo page.

Tables

Tables aren't part of the core Markdown spec, but they are part of GFM and Markdown Here supports them. They are an easy way of adding tables to your email -- a task that would otherwise require copy-pasting from another application.

no-highlight
Colons can be used to align columns.

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |

The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.

Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3

Colons can be used to align columns.

Tables Are Cool
col 3 is right-aligned $1600
col 2 is centered $12
zebra stripes are neat $1

The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.

Markdown Less Pretty
Still renders nicely
1 2 3

Blockquotes

no-highlight
> Blockquotes are very handy in email to emulate reply text.
> This line is part of the same quote.

Quote break.

> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.

Blockquotes are very handy in email to emulate reply text. This line is part of the same quote.

Quote break.

This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can put Markdown into a blockquote.

Inline HTML

You can also use raw HTML in your Markdown, and it'll mostly work pretty well.

no-highlight
<dl>
  <dt>Definition list</dt>
  <dd>Is something people use sometimes.</dd>

  <dt>Markdown in HTML</dt>
  <dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
</dl>
Definition list
Is something people use sometimes.
Markdown in HTML
Does *not* work **very** well. Use HTML tags.

Horizontal Rule

Three or more...

---

Hyphens

***

Asterisks

___

Underscores

Three or more...


Hyphens


Asterisks


Underscores

Line Breaks

My basic recommendation for learning how line breaks work is to experiment and discover -- hit <Enter> once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You'll soon learn to get what you want. "Markdown Toggle" is your friend.

Here are some things to try out:

Here's a line for us to start with.

This line is separated from the one above by two newlines, so it will be a *separate paragraph*.

This line is also a separate paragraph, but...
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.

Here's a line for us to start with.

This line is separated from the one above by two newlines, so it will be a separate paragraph.

This line is also begins a separate paragraph, but... This line is only separated by a single newline, so it's a separate line in the same paragraph.

(Technical note: Markdown Here uses GFM line breaks, so there's no need to use MD's two-space line breaks.)

YouTube Videos

They can't be added directly but you can add an image with a link to the video like this:

no-highlight
<a href="http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE
" target="_blank"><img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>

Or, in pure Markdown, but losing the image sizing and border:

no-highlight
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)

TeX Mathematical Formulae

A full description of TeX math symbols is beyond the scope of this cheatsheet. Here's a good reference, and you can try stuff out on CodeCogs. You can also play with formulae in the Markdown Here options page.

Here are some examples to try out:

$-b \pm \sqrt{b^2 - 4ac} \over 2a$
$x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + a_4}}}$
$\forall x \in X, \quad \exists y \leq \epsilon$

The beginning and ending dollar signs ($) are the delimiters for the TeX markup.

Build the book's HTML locally

Once you've generated the markdown for your notebooks and installed the necessary dependencies. You are ready to build your book HTML.

Ensure that your notebooks have been converted to markdown, there should be a collection of them in _build/.

In order to locally build your book's HTML with Jekyll, you'll need to either install a container software (Docker or Singularity) or Ruby.

In our experience, we've found that containers provide an easier installation for most systems. If you are developing on a system where you have administrator privileges (i.e., you have root permissions), we recommend you use Docker.

We also provide instructions for using Singularity, an alternate containerization software for systems where you do not have administrator privileges. To learn more about using containers, please see the Docker for scientists guide.

Building your site locally with Containers: Docker

First, you'll need to make sure you have Docker installed. There are installation instructions for each operating system to guide you through this process.

Once Docker is available on your system, you can build the image locally with:

docker pull emdupre/jupyter-book

You can then access this image with:

docker run --rm --security-opt label:disable  \
   -v /full/path/to/your/book:/srv/jekyll \
   -p 4000:4000 \
   -it -u 1000:1000 \
   emdupre/jupyter-book bundle exec jekyll serve --host 0.0.0.0

If you navigate to http://0.0.0.0:4000/jupyter-book/ in your browser, you should see a preview copy of your book. If you instead see an error, please try to update your local book; see the Jupyter Book FAQ section for more details on how to do so.

Building your site locally with Containers: Singularity

If you are on a system where you do not have administrator privileges (such as a shared computing cluster), you will not be able to use Docker. Instead, you can use Singularity. First, you'll need to check with your resource manager that Singularity is available on your system.

You can then create a Jupyter Book Singularity image using:

singularity build jupyter-book.simg docker://emdupre/jupyter-book

Next, you can access this image with:

singularity run -B /full/path/to/your/book:/srv/jekyll \
    --pwd /srv/jekyll \
    jupyter-book.simg bundle exec jekyll serve

And that's it! If you navigate to http://127.0.0.1:4000/jupyter-book/ in your browser, you should see a preview copy of your book.

Building your site locally with Ruby

You can also choose to build your site locally without a container. In this case, you'll need Ruby, an open-source programming language, to build your site's HTML with Jekyll. The easiest way to install Ruby on nix systems is to use the conda* package manager:

conda install -c conda-forge ruby

Once you have Ruby installed, run

make install

which will install Bundler (a Ruby dependency management tool) and then install the plugins needed to build the site for your book.

You can then build the site locally by running:

make site

Alternatively, you can preview your book's site locally by running this command:

make serve

This should open up a port on your computer with a live version of the book.

When should you build the HTML locally?

You might ask: if GitHub pages can build my site automatically from the markdown files, why build it locally? The main reason for this is that you get more flexibility by building locally and serving raw HTML, as opposed to auto-building the site with GitHub-pages.

In particular, if you wish to use any extra Jekyll plugins, such as the jekyll-scholar plugin that enables you to add citations and bibliographies, then you need to build your site locally as HTML. GitHub-pages doesn't let you enable any extra plugins if it auto-builds your site.

Create an online repository for your book

You've created your book on your own computer, but you haven't yet added it online. This section covers the steps to create your own GitHub repository, and to add your book's content to it.

  1. First, log-in to GitHub, then go to the "create a new repository" page:

https://github.com/new

  1. Next, add a name and description for your book. You can choose whatever initialization you'd like.

  2. Now, clone the empty repository to your computer:

    git clone https://github.com/<my-org>/<my-book-name>
    
  3. Copy all of your book files and folders (what was created when you ran jupyter-book create mybook) into the new repository. For example, if you created your book locally with jupyter-book create mylocalbook and your online repository is called myonlinebook, the command would be:

    cp -r mylocalbook/* myonlinebook/
    

    This will copy over the local book files into the online book folder.

  4. Commit the new files to the repository in myonlinebook/:

    cd myonlinebook
    git add ./*
    git commit -m "adding my first book!"
    git push
    

That's it!

Publish your book online with GitHub Pages

Once you've built the markdown for your book (in _build) or built the HTML for your book (in _site), you can push your book contents to GitHub so that others can access your book. To do so, follow these steps:

  1. Confirm that your site files are built. You should see a collection of markdown files/folders in the _build folder, or a collection of HTML in your _site/ folder.
  2. Commit and push the changes to your repository.
  3. Enable GitHub site building for your repository.

    From your GitHub repository, click Settings then scroll down to the GitHub Pages section. You should see the message Your site is published at <YOUR-URL>. Ensure that you're building from the correct folder.

  4. Go to the URL listed at <YOUR-URL> and you should see your live site.