Demo page to showcase markdown

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

It is taken from the Markdowndocumentation, and is meant to give an idea of how Jupyter Book renders really long pages ofvery 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 charactersin 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

HeadersEmphasisListsLinksImagesCode and Syntax HighlightingTablesBlockquotesInline HTMLHorizontal RuleLine BreaksYouTube VideosTeX Mathematical Formulae

Headers

  1. no-highlight
  2. # H1
  3. ## H2
  4. ### H3
  5. #### H4
  6. ##### H5
  7. ###### H6
  8. Alternatively, for H1 and H2, an underline-ish style:
  9. Alt-H1
  10. ======
  11. Alt-H2
  12. ------

H1

H2

H3

H4

H5
H6

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

Alt-H1

Alt-H2

Emphasis

  1. no-highlight
  2. Emphasis, aka italics, with *asterisks* or _underscores_.
  3. Strong emphasis, aka bold, with **asterisks** or __underscores__.
  4. Combined emphasis with **asterisks and _underscores_**.
  5. 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

  1. no-highlight
  2. 1. First ordered list item
  3. 2. Another item
  4. * Unordered sub-list.
  5. 1. Actual numbers don't matter, just that it's a number
  6. 1. Ordered sub-list
  7. 4. And another item.
  8. Some text that should be aligned with the above item.
  9. * Unordered list can use asterisks
  10. - Or minuses
  11. + Or pluses
  • First ordered list item
  • Another item
    • Unordered sub-list.
  • Actual numbers don't matter, just that it's a number
    • Ordered sub-list
  • 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.

  1. no-highlight
  2. [I'm an inline-style link](https://www.google.com)
  3. [I'm a reference-style link][Arbitrary case-insensitive reference text]
  4. [You can use numbers for reference-style link definitions][1]
  5. Or leave it empty and use the [link text itself]
  6. URLs and URLs in angle brackets will automatically get turned into links.
  7. http://www.example.com or <http://www.example.com> and sometimes
  8. example.com (but not on Github, for example).
  9. Some text to show that the reference links can follow later.
  10. [arbitrary case-insensitive reference text]: https://www.mozilla.org
  11. [1]: http://slashdot.org
  12. [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 sometimesexample.com (but not on Github, for example).

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

Images

  1. no-highlight
  2. Here's our logo (hover to see the title text):
  3. Inline-style:
  4. ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
  5. Reference-style:
  6. ![alt text][logo]
  7. [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.

  1. no-highlight
  2. 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.

  1. ```javascript
  2. var s = "JavaScript syntax highlighting";
  3. alert(s);
  4. ```
  5. ```python
  6. s = "Python syntax highlighting"
  7. print s
  8. ```
  9. ```
  10. No language indicated, so no syntax highlighting.
  11. But let's throw in a <b>tag</b>.
  12. ```
  1. var s = "JavaScript syntax highlighting";
  2. alert(s);
  1. s = "Python syntax highlighting"
  2. print s
  1. No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
  2. 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.

  1. no-highlight
  2. Colons can be used to align columns.
  3. | Tables | Are | Cool |
  4. | ------------- |:-------------:| -----:|
  5. | col 3 is | right-aligned | $1600 |
  6. | col 2 is | centered | $12 |
  7. | zebra stripes | are neat | $1 |
  8. The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
  9. Markdown | Less | Pretty
  10. --- | --- | ---
  11. *Still* | `renders` | **nicely**
  12. 1 | 2 | 3

Colons can be used to align columns.

TablesAreCool
col 3 isright-aligned$1600
col 2 iscentered$12
zebra stripesare 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.

MarkdownLessPretty
Stillrendersnicely
123

Blockquotes

  1. no-highlight
  2. > Blockquotes are very handy in email to emulate reply text.
  3. > This line is part of the same quote.
  4. Quote break.
  5. > 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.

  1. no-highlight
  2. <dl>
  3. <dt>Definition list</dt>
  4. <dd>Is something people use sometimes.</dd>
  5. <dt>Markdown in HTML</dt>
  6. <dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
  7. </dl>
  • Definition list
  • Is something people use sometimes.
  • Markdown in HTML
  • Does not work very well. Use HTML tags.

Horizontal Rule

  1. Three or more...
  2. ---
  3. Hyphens
  4. ***
  5. Asterisks
  6. ___
  7. 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:

  1. Here's a line for us to start with.
  2. This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
  3. This line is also a separate paragraph, but...
  4. 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:

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

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

  1. no-highlight
  2. [![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:

  1. $-b \pm \sqrt{b^2 - 4ac} \over 2a$
  2. $x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + a_4}}}$
  3. $\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 thenecessary dependencies. You are ready to build your book HTML.

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

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

In our experience, we've found that containersprovide 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 theDocker 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 systemto guide you through this process.

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

  1. docker pull emdupre/jupyter-book

You can then access this image with:

  1. docker run --rm --security-opt label:disable \
  2. -v /full/path/to/your/book:/srv/jekyll \
  3. -p 4000:4000 \
  4. -it -u 1000:1000 \
  5. 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 sectionfor 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 sharedcomputing 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 availableon your system.

You can then create a Jupyter Book Singularity image using:

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

Next, you can access this image with:

  1. singularity run -B /full/path/to/your/book:/srv/jekyll \
  2. --pwd /srv/jekyll \
  3. 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'sHTML with Jekyll. The easiest way to install Ruby on nix systems is to usethe conda* package manager:

  1. conda install -c conda-forge ruby

Once you have Ruby installed, run

  1. make install

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

You can then build the site locally by running:

  1. make site

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

  1. 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, whybuild it locally? The main reason for this is that you get more flexibility by building locallyand 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 thatenables you to add citations and bibliographies, then you need to build your sitelocally 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 itonline. This section covers the steps to create your own GitHub repository,and to add your book's content to it.

  • First, log-in to GitHub, then go to the "create a new repository" page: https://github.com/new

  • Next, add a name and description for your book. You can choose whateverinitialization you'd like.

  • Now, clone the empty repository to your computer:

  1. git clone https://github.com/<my-org>/<my-book-name>
  • 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 mylocalbookand your online repository is called myonlinebook, the command would be:
  1. cp -r mylocalbook/* myonlinebook/

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

  • Commit the new files to the repository in myonlinebook/:
  1. cd myonlinebook
  2. git add ./*
  3. git commit -m "adding my first book!"
  4. 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 HTMLfor your book (in _site), you can push your book contents to GitHub so thatothers can access your book. To do so, follow these steps:

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

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

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

This page was created by The Jupyter Book Community