-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
jupyter: | ||
kernelspec: | ||
display_name: Python 3 | ||
language: python | ||
name: python3 | ||
--- | ||
|
||
# Markdown, code and raw cells | ||
|
||
## Markdown cells | ||
|
||
This is a Markdown cell. Markdown cells end with either a code cell, or two consecutive blank lines in the text. | ||
|
||
If you prefer that Markdown headings define new cells, have a look at the `split_at_heading` option. | ||
|
||
Indented code is accepted, and consecutive blank lines there do not break Markdown cells: | ||
|
||
def f(x): | ||
return 1 | ||
|
||
|
||
def h(x): | ||
return f(x)+2 | ||
|
||
|
||
## Code cells | ||
|
||
```python | ||
"""This code cell starts with ` ```python`""" | ||
1 + 1 | ||
``` | ||
|
||
## Raw cells | ||
|
||
Raw cells starts with ` ``` `, like here: | ||
``` | ||
THIS IS A RAW CELL | ||
``` | ||
|
||
# Protected Markdown cells | ||
|
||
If you want to include code blocks (or two consecutive blank lines) in a Markdown cell, use explicit Markdown cell delimiters `<!-- #region -->` and `<!-- #endregion -->`. | ||
|
||
<!-- #region --> | ||
This Markdown cell has two consecutive blank lines | ||
|
||
|
||
And then a code block which is not a Jupyter code cell: | ||
```python | ||
2 + 2 | ||
``` | ||
<!-- #endregion --> | ||
|
||
# Metadata | ||
|
||
Metadata are supported for all cell types. | ||
|
||
## Markdown cells | ||
|
||
<!-- #region Region title {"key": "value"} --> | ||
A cell with a title and additional metadata. | ||
<!-- #endregion --> | ||
|
||
## Code and raw cells | ||
|
||
```python tags=["parameters"] | ||
a = 2 | ||
``` |
129 changes: 129 additions & 0 deletions
129
tests/notebooks/mirror/md_to_ipynb/jupytext_markdown.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Markdown, code and raw cells\n", | ||
"\n", | ||
"## Markdown cells\n", | ||
"\n", | ||
"This is a Markdown cell. Markdown cells end with either a code cell, or two consecutive blank lines in the text.\n", | ||
"\n", | ||
"If you prefer that Markdown headings define new cells, have a look at the `split_at_heading` option.\n", | ||
"\n", | ||
"Indented code is accepted, and consecutive blank lines there do not break Markdown cells:\n", | ||
"\n", | ||
" def f(x):\n", | ||
" return 1\n", | ||
"\n", | ||
"\n", | ||
" def h(x):\n", | ||
" return f(x)+2\n", | ||
"\n", | ||
"\n", | ||
"## Code cells" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\"\"\"This code cell starts with ` ```python`\"\"\"\n", | ||
"1 + 1" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"lines_to_next_cell": 0 | ||
}, | ||
"source": [ | ||
"## Raw cells\n", | ||
"\n", | ||
"Raw cells starts with ` ``` `, like here:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "raw", | ||
"metadata": {}, | ||
"source": [ | ||
"THIS IS A RAW CELL" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Protected Markdown cells\n", | ||
"\n", | ||
"If you want to include code blocks (or two consecutive blank lines) in a Markdown cell, use explicit Markdown cell delimiters `<!-- #region -->` and `<!-- #endregion -->`." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"This Markdown cell has two consecutive blank lines\n", | ||
"\n", | ||
"\n", | ||
"And then a code block which is not a Jupyter code cell:\n", | ||
"```python\n", | ||
"2 + 2\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Metadata\n", | ||
"\n", | ||
"Metadata are supported for all cell types.\n", | ||
"\n", | ||
"## Markdown cells" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"key": "value", | ||
"title": "Region title" | ||
}, | ||
"source": [ | ||
"A cell with a title and additional metadata." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Code and raw cells" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"tags": [ | ||
"parameters" | ||
] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"a = 2" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters