{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "93aafb4b",
   "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": "189501a0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n"
     ]
    }
   ],
   "source": [
    "print(2 + 2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a3979e98",
   "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": {
   "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.12.8"
  },
  "source_map": [
   13,
   25,
   27
  ]
 },
 "nbformat": 4,
 "nbformat_minor": 5
}