Skip to content
FeaturesPricingBlogDownload

← All posts

Jupyter notebook Markdown: cells, math and .md export

Use Markdown in Jupyter notebooks, from cell syntax, LaTeX math and images to exporting a notebook as .md with nbconvert or pairing it with Jupytext.

A clean diagram card on a light background showing a notebook with Markdown and code cells exported to a plain Markdown file

In a Jupyter notebook, Markdown lives in Markdown cells. Select a cell, press Esc and then M (or pick Markdown from the cell type menu), type headings, lists, links, tables and LaTeX math, and run the cell with Shift+Enter to see it rendered. To get the whole notebook out as Markdown, run jupyter nbconvert --to markdown analysis.ipynb, which writes analysis.md plus a folder of output images. To keep a notebook as a Markdown file permanently, pair it with Jupytext.

The shortcuts below apply to JupyterLab and Jupyter Notebook 7, and the command line tools to current nbconvert and Jupytext releases (checked November 2026).

How do you add a Markdown cell in Jupyter?

A new cell is a code cell by default. Change its type in one of these ways:

Where How
JupyterLab or Jupyter Notebook Press Esc to enter command mode, then M. Press Y to turn it back into code
Notebook toolbar Choose Markdown in the cell type dropdown
VS Code Click + Markdown between cells, or press M on a selected cell

Edit a rendered Markdown cell by double-clicking it (or pressing Enter in command mode), and render it again with Shift+Enter. Headings in Markdown cells also build the notebook's table of contents in JupyterLab and VS Code, so a few ## headings make a long notebook much easier to move around in.

What Markdown works in a Jupyter cell?

Jupyter renders GitHub-style Markdown, plus math:

## Cleaning the survey data

We drop rows with a **missing age** and keep only complete responses.
See the [codebook](docs/codebook.md) for column names.

| Column | Type | Notes |
| --- | --- | --- |
| age | int | Years at survey date |
| region | str | One of four codes |

- [x] Remove duplicates
- [ ] Recode region names

All of that renders as you would expect: a heading, bold text, a link, a table and a task list. Fenced code blocks work too and get syntax highlighting, but code in a Markdown cell is only displayed, not run; use a code cell for code that should execute. The code blocks page covers fences and language names.

Raw HTML also works in Markdown cells, which helps for things Markdown lacks, such as <details> for a collapsible section. Keep it light, because some notebook viewers sanitize HTML differently.

How do you write math in a Jupyter Markdown cell?

Use LaTeX between dollar signs. Single dollars put math inside a sentence, and double dollars put it on its own line:

The energy is $E = mc^2$, and the area under the curve is

$$
\int_0^1 x^2 \, dx = \frac{1}{3}
$$

Jupyter renders math with MathJax, so most LaTeX math commands work: fractions, sums, Greek letters, matrices and aligned equations. The same dollar-sign syntax renders on GitHub and in many Markdown editors, which matters when you export the notebook; see Markdown math for where it is and isn't supported.

How do you add images to a Markdown cell?

You have two choices, and they behave differently when you share the notebook:

  1. Link a file: ![Survey map](figures/map.png). The notebook stays small, but the image file has to travel with it.
  2. Attach the image: drag an image file into a Markdown cell in edit mode, or paste one from the clipboard. Jupyter stores the image inside the .ipynb file and writes ![map.png](attachment:map.png) in the cell.

Attachments are convenient for a notebook you email, but they make the file larger, and how they come through a Markdown export depends on the tool and its version, so check the result. For notebooks that live in a repository, linked files are easier to manage.

How do you export a Jupyter notebook to Markdown?

Use nbconvert, which comes with Jupyter:

jupyter nbconvert --to markdown analysis.ipynb

This writes analysis.md next to the notebook. Markdown cells are copied as they are, code cells become fenced code blocks, text output appears below each block, and plots and other image outputs are saved into an analysis_files folder and linked from the Markdown.

Useful options:

Option Effect
--no-input Leaves out the code and keeps only Markdown and outputs, for a report
--output report Names the file report.md
--output-dir exports Writes into another folder
--execute Runs the notebook first, so outputs are fresh

To export every notebook in a folder, pass them all at once: jupyter nbconvert --to markdown *.ipynb. Rich outputs, such as a pandas DataFrame shown as a table, can be written as HTML inside the Markdown file. They display in renderers that allow HTML and as raw tags in those that don't, so check them if the file is going somewhere strict.

The export is a snapshot. Editing analysis.md doesn't change the notebook, and the next export overwrites the file.

How do you keep a notebook as a Markdown file with Jupytext?

Jupytext stores a notebook as a Markdown file (or a Python script) that Jupyter can open and run like an .ipynb. The text file holds Markdown cells as Markdown and code cells as fenced code blocks, without outputs.

pip install jupytext

jupytext --to md analysis.ipynb
jupytext --to notebook analysis.md
jupytext --set-formats ipynb,md analysis.ipynb
jupytext --sync analysis.ipynb

The first two commands convert in either direction. The third pairs the notebook with a Markdown file, so saving one in Jupyter updates the other, and --sync brings them back in step after you edit the Markdown file outside Jupyter. For Markdown with richer directives, --to myst writes MyST Markdown, which documentation tools such as Jupyter Book read.

Which Jupyter notebook Markdown format belongs in version control?

Format Diffs Keeps outputs Opens in Jupyter
.ipynb only Hard to read (JSON) Yes Yes
nbconvert .md Readable As text and image files No, it's a one-way export
Jupytext .md Readable, line by line No Yes, with Jupytext installed
Jupytext .md paired with .ipynb Commit the .md In the local .ipynb Yes

Many teams commit the Jupytext Markdown file and keep the .ipynb out of version control, so reviews show code and prose changes instead of JSON and image data. For research projects with many notebooks, the researchers use case covers organizing notes and sources alongside them.

Common questions

Can a Markdown cell show the value of a variable?

Not on its own; Markdown cells are static text. To write Markdown that includes computed values, generate it from a code cell:

from IPython.display import Markdown

Markdown(f"**Rows after cleaning:** {len(df)}")

The output appears formatted, like a Markdown cell, and updates each time the cell runs.

How do you share a notebook as a report without the code?

Export it to HTML and leave out the inputs: jupyter nbconvert --to html --no-input analysis.ipynb. The page keeps the Markdown cells, tables and charts, and anyone can open it in a browser without Jupyter.

Notebook Markdown in Noteline

Noteline, which we make, opens the Markdown files that nbconvert and Jupytext write, not .ipynb notebooks themselves. In those files, headings, task lists and tables show formatted as you type, and fenced code blocks get syntax highlighting for Python and other languages. LaTeX math is not rendered in Noteline's editor; formulas stay as their dollar-sign source, which is still readable and renders again once the file is back in Jupyter or on GitHub. Images from analysis_files show as their alt text rather than the picture.

Start with one note. Keep the file.

Open a folder and write. Every note is a plain .md file, with no account to create.

Try desktop free for 14 days ↓Free on iPhone, iPad and Android →

Desktop: 14-day trial, then $9.99 once. Mobile apps: free. No account.

Keep reading

  • Math in Markdown
  • Markdown code blocks
  • Markdown for researchers
  • How to keep AI meeting notes as Markdown files you own
  • AI memory files: what your assistant should remember, kept in Markdown
  • An AI research workflow in Markdown: sources, summaries and claims

A Markdown note editor with everything you need

We’re listening

Tell us what you need or what gets in your way. If something isn’t working, write to us any time.

contact@noteline.io→

Product

  • Download
  • Pricing
  • Features
  • Changelog

Learn

  • Markdown syntax
  • Use cases
  • Blog

Compare

  • vs Obsidian
  • vs Notion

Support

  • Help
  • Support
  • Privacy
  • Terms

© 2026 Notelinecontact@noteline.io