{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "8f642e28",
   "metadata": {},
   "source": [
    "# Special content blocks\n",
    "\n",
    "There are a few content blocks that are unique to this theme.\n",
    "\n",
    "\n",
    "## Quotations and epigraphs\n",
    "\n",
    "Here is what quotations and epigraphs look like in `sphinx-book-theme`:\n",
    "\n",
    "A quote with no attribution:\n",
    "\n",
    "> Here's my quote, it's pretty neat.\n",
    "> I wonder how many lines I can create with\n",
    "> a single stream-of-consciousness quote.\n",
    "> I could try to add a list of ideas to talk about.\n",
    "> I suppose I could just keep going on forever,\n",
    "> but I'll stop here.\n",
    "\n",
    "Sometimes you'd like to draw more attention to a quote. To do so, use the `{epigraph}` directive.\n",
    "Below is an epigraph, click the button to the right of it to show the code that was used\n",
    "to generate it:\n",
    "\n",
    "```{epigraph}\n",
    "Here's my quote, it's pretty neat.\n",
    "I wonder how many lines I can create with\n",
    "a single stream-of-consciousness quote.\n",
    "I could try to add a list of ideas to talk about.\n",
    "I suppose I could just keep going on forever,\n",
    "but I'll stop here.\n",
    "```\n",
    "\n",
    "`````{toggle}\n",
    "````\n",
    "```{epigraph}\n",
    "Here's my quote, it's pretty neat.\n",
    "I wonder how many lines I can create with\n",
    "a single stream-of-consciousness quote.\n",
    "I could try to add a list of ideas to talk about.\n",
    "I suppose I could just keep going on forever,\n",
    "but I'll stop here.\n",
    "```\n",
    "````\n",
    "`````\n",
    "\n",
    "You can also add an attribution to epigraphs by adding a blank line,\n",
    "followed by a line that starts with `--`. This will be renderered like so:\n",
    "\n",
    "```{epigraph}\n",
    "Here's my quote, it's pretty neat.\n",
    "I wonder how many lines I can create with\n",
    "a single stream-of-consciousness quote.\n",
    "I could try to add a list of ideas to talk about.\n",
    "I suppose I could just keep going on forever,\n",
    "but I'll stop here.\n",
    "\n",
    "-- Jo the Jovyan, *[the jupyter book docs](https://beta.jupyterbook.org)*\n",
    "```\n",
    "\n",
    "`````{toggle}\n",
    "````\n",
    "```{epigraph}\n",
    "Here's my quote, it's pretty neat.\n",
    "I wonder how many lines I can create with\n",
    "a single stream-of-consciousness quote.\n",
    "I could try to add a list of ideas to talk about.\n",
    "I suppose I could just keep going on forever,\n",
    "but I'll stop here.\n",
    "\n",
    "-- Jo the Jovyan, *[the jupyter book docs](https://beta.jupyterbook.org)*\n",
    "```\n",
    "````\n",
    "`````\n",
    "\n",
    "## Sidebars\n",
    "\n",
    "There are two different kinds of sidebar-like content in `sphinx-book-theme`,\n",
    "typical `{sidebar}` directives, as well as a theme-specific `{margin}` directive.\n",
    "This section covers both. Both allow you to place extra content\n",
    "separately from your main content.\n",
    "\n",
    "```{tip}\n",
    "Sidebar content will generally overlap with the white space where your site's\n",
    "table of contents lives. When the reader scrolls sidebar content into view, the\n",
    "right TOC should hide itself automatically.\n",
    "```\n",
    "\n",
    "### Margin content\n",
    "\n",
    "You can specify content that should exist in the right margin. This will behave\n",
    "like a regular sidebar until the screen hits a certain width, at which point this\n",
    "content will \"pop out\" to the right white space.\n",
    "\n",
    "There are two ways to add content to the margin: via the `{margin}` directive, and via adding CSS classes to your own content.\n",
    "\n",
    "#### Use a `{margin}` directive to add margin content\n",
    "\n",
    "The `{margin}` directive allows you to create margin content with your own title and content block.\n",
    "It is a wrapper around the Sphinx `{sidebar}` directive, and largely does its magic via CSS classes (see below).\n",
    "\n",
    "Here's how you can use the `{margin}` directive:\n",
    "\n",
    "```{margin} **Here is my margin content**\n",
    "It is pretty cool!\n",
    "```\n",
    "\n",
    "````\n",
    "```{margin} **My margin title**\n",
    "Here is my margin content, it is pretty cool!\n",
    "```\n",
    "````\n",
    "\n",
    "#### Use CSS classes to add margin content\n",
    "\n",
    "You may also directly add CSS classes to elements on your page in order to make them behave like margin content.\n",
    "To do so, add the `margin` CSS class to any element on the page.\n",
    "Many Sphinx directives allow you to directly add classes.\n",
    "For example, here's the syntax to add a `margin` class to a `{note}` directive:\n",
    "\n",
    ":::{note}\n",
    ":class: margin\n",
    "This note will be in the margin!\n",
    ":::\n",
    "\n",
    "```\n",
    ":::{note}\n",
    ":class: margin\n",
    "This note will be in the margin!\n",
    ":::\n",
    "```\n",
    "\n",
    "This works for most elements on the page, but in general this works best for \"parent containers\" that are the top-most element of a bundle of content.\n",
    "\n",
    "For example, we can even put a whole figure in the margin like so:\n",
    "\n",
    "\n",
    "You can also put the whole figure in the margin if you like.\n",
    "Here is a figure with a caption below. We'll add a note below to create\n",
    "some vertical space to see better.\n",
    "\n",
    "```{figure} images/cool.jpg\n",
    "---\n",
    "figclass: margin\n",
    "alt: My figure text\n",
    "name: myfig4\n",
    "---\n",
    "And here is my figure caption\n",
    "```\n",
    "\n",
    "````\n",
    "```{figure} images/cool.jpg\n",
    "---\n",
    "figclass: margin\n",
    "alt: My figure text\n",
    "name: myfig4\n",
    "---\n",
    "And here is my figure caption\n",
    "```\n",
    "````\n",
    "\n",
    "We can reference the figure with {ref}`myfig4`. Or a numbered reference like\n",
    "{numref}`myfig4`.\n",
    "\n",
    "#### Figure captions in the margin\n",
    "\n",
    "You can configure figures to use the margin for captions.\n",
    "Here is a figure with a caption to the right.\n",
    "\n",
    "```{figure} images/cool.jpg\n",
    "---\n",
    "width: 60%\n",
    "figclass: margin-caption\n",
    "alt: My figure text\n",
    "name: myfig5\n",
    "---\n",
    "And here is my figure caption, if you look to the left, you can see that COOL is in big red letters. But you probably already noticed that, really I am just taking up space to see how the margin caption looks like when it is really long :-).\n",
    "```\n",
    "\n",
    "And the text that produced it:\n",
    "\n",
    "````\n",
    "```{figure} images/cool.jpg\n",
    "---\n",
    "width: 60%\n",
    "figclass: margin-caption\n",
    "alt: My figure text\n",
    "name: myfig5\n",
    "---\n",
    "And here is my figure caption, if you look to the left, you can see that COOL is in big red letters. But you probably already noticed that, really I am just taking up space to see how the margin caption looks like when it is really long :-)\n",
    "```\n",
    "````\n",
    "\n",
    "We can reference the figure with {ref}`this reference <myfig5>`. Or a numbered reference like\n",
    "{numref}`myfig5`.\n",
    "\n",
    "### Content sidebars\n",
    "\n",
    "Content sidebars exist in-line with your text, but allow the rest of the\n",
    "page to flow around them, rather than moving to the right margin.\n",
    "To add content sidebars, use this syntax:\n",
    "\n",
    "````{sidebar} **My sidebar title**\n",
    "```{note}\n",
    "Here is my sidebar content, it is pretty cool!\n",
    "```\n",
    "![](images/cool.jpg)\n",
    "````\n",
    "\n",
    "Note how the content wraps around the sidebar to the right.\n",
    "However, the sidebar text will still be in line with your content. There are\n",
    "certain kinds of elements, such as \"note\" blocks and code cells, that may\n",
    "clash with your sidebar. If this happens, try using a `{margin}` instead.\n",
    "\n",
    "````\n",
    "```{sidebar} **My sidebar title**\n",
    "Here is my sidebar content, it is pretty cool!\n",
    "```\n",
    "````\n",
    "\n",
    "### Adding content to margins and sidebars\n",
    "\n",
    "Sidebar/margin content can include all kinds of things, such as code blocks:\n",
    "\n",
    "````{margin} Code blocks in margins\n",
    "```python\n",
    "print(\"here is some python\")\n",
    "```\n",
    "````\n",
    "\n",
    "`````\n",
    "````{margin} Code blocks in margins\n",
    "```python\n",
    "print(\"here is some python\")\n",
    "```\n",
    "````\n",
    "`````\n",
    "\n",
    "as well as admonitions and images:\n",
    "\n",
    "````{margin} **Notes in margins**\n",
    "```{note}\n",
    "Wow, a note with an image in a margin!\n",
    "![](images/cool.jpg)\n",
    "```\n",
    "````\n",
    "\n",
    "`````\n",
    "````{margin} **Notes in margins**\n",
    "```{note}\n",
    "Wow, a note with an image in a margin!\n",
    "![](images/cool.jpg)\n",
    "```\n",
    "````\n",
    "`````\n",
    "\n",
    "## Full-width content\n",
    "\n",
    "Full-width content extends into the right margin, making it stand out against\n",
    "the rest of your book's content. To add full-width content to your page, add the\n",
    "class `full-width` to any of the elements in your documentation. For example, you can\n",
    "add a `full-width` tag to a note element like this:\n",
    "\n",
    "````\n",
    "```{note}\n",
    ":class: full-width\n",
    "This content will be full-width\n",
    "```\n",
    "````\n",
    "\n",
    "This code results in the following output:\n",
    "\n",
    "```{note}\n",
    ":class: full-width\n",
    "This content will be full-width\n",
    "```\n",
    "\n",
    "```{admonition} A note for ipynb users\n",
    "If you are using a Jupyter Notebook as inputs to your documentation using the\n",
    "[MyST-NB extension](https://myst-nb.readthedocs.io/en/latest/), you can trigger\n",
    "this behavior with a code cell by adding a `full-width` tag to the cell.\n",
    "```"
   ]
  }
 ],
 "metadata": {
  "jupytext": {
   "formats": "ipynb,md:myst",
   "text_representation": {
    "extension": ".md",
    "format_name": "myst",
    "format_version": "0.8",
    "jupytext_version": "1.4.2"
   }
  },
  "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.7.9"
  },
  "source_map": [
   13
  ]
 },
 "nbformat": 4,
 "nbformat_minor": 5
}