{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "078640d4",
   "metadata": {},
   "source": [
    "# Notebooks with MyST Markdown\n",
    "\n",
    "Jupyter Book also lets you write text-based notebooks using MyST Markdown.\n",
    "See [the Notebooks with MyST Markdown documentation](https://jupyterbook.org/file-types/myst-notebooks.html) for more detailed instructions.\n",
    "This page shows off a notebook written in MyST Markdown.\n",
    "\n",
    "## An example cell\n",
    "\n",
    "With MyST Markdown, you can define code cells with a directive like so:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "932593cd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n"
     ]
    }
   ],
   "source": [
    "print(2 + 2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1f01b7c8",
   "metadata": {},
   "source": [
    "When your book is built, the contents of any `{code-cell}` blocks will be\n",
    "executed with your default Jupyter kernel, and their outputs will be displayed\n",
    "in-line with the rest of your content.\n",
    "\n",
    "```{seealso}\n",
    "Jupyter Book uses [Jupytext](https://jupytext.readthedocs.io/en/latest/) to convert text-based files to notebooks, and can support [many other text-based notebook files](https://jupyterbook.org/file-types/jupytext.html).\n",
    "```\n",
    "\n",
    "## Create a notebook with MyST Markdown\n",
    "\n",
    "MyST Markdown notebooks are defined by two things:\n",
    "\n",
    "1. YAML metadata that is needed to understand if / how it should convert text files to notebooks (including information about the kernel needed).\n",
    "   See the YAML at the top of this page for example.\n",
    "2. The presence of `{code-cell}` directives, which will be executed with your book.\n",
    "\n",
    "That's all that is needed to get started!\n",
    "\n",
    "## Quickly add YAML metadata for MyST Notebooks\n",
    "\n",
    "If you have a markdown file and you'd like to quickly add YAML metadata to it, so that Jupyter Book will treat it as a MyST Markdown Notebook, run the following command:\n",
    "\n",
    "```\n",
    "jupyter-book myst init path/to/markdownfile.md\n",
    "```"
   ]
  }
 ],
 "metadata": {
  "jupytext": {
   "cell_metadata_filter": "-all",
   "formats": "md:myst",
   "text_representation": {
    "extension": ".md",
    "format_name": "myst",
    "format_version": 0.13,
    "jupytext_version": "1.11.5"
   }
  },
  "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.8.13"
  },
  "source_map": [
   14,
   26,
   28
  ]
 },
 "nbformat": 4,
 "nbformat_minor": 5
}