Skip to content

Commit f5b44c2

Browse files
committed
Add Positron notebook page
1 parent 78172a6 commit f5b44c2

File tree

7 files changed

+153
-54
lines changed

7 files changed

+153
-54
lines changed

docs/computations/_jupyter-execute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ quarto render notebook.ipynb --execute
66

77
You can also specify this behavior within the notebook's YAML front matter:
88

9-
``` yaml
9+
```{.yaml filename="notebook.ipynb"}
1010
---
1111
title: "My Notebook"
1212
execute:

docs/tools/_code-oss_notebook.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
In addition to editing Quarto documents as plain-text `.qmd` files, you can also use the {{< meta tool.name >}} Notebook Editor to author `.ipynb` notebooks that are rendered with Quarto. In this article we'll review the basics of editing `.ipynb` notebooks for use with Quarto.
2+
3+
## Render and Preview
4+
5+
The basic workflow for editing notebooks for use with Quarto is identical to the workflow for `.qmd` files. Edit the file and then execute the **Quarto: Preview** command (you can alternatively use the <kbd>Ctrl+Shift+K</kbd> keyboard shortcut). You'll see a preview of the published page side by side with the notebook:
6+
7+
![]({{< meta tool.image-prefix >}}-notebook.png){.border}
8+
9+
After you've done an initial **Quarto: Preview**, the preview will automatically update every time you save the notebook.
10+
11+
## YAML Front Matter
12+
13+
The first cell of your notebook should be a **Raw** cell that contains the document title, author, and any other options you need to specify. Note that you can switch the type of a cell to **Raw** using the cell type menu at the bottom right of the cell:
14+
15+
![](images/vscode-raw.png){.border fig-alt="The top section of an ipynb file open in VSCode. There is a Raw cell containing yaml front matter."}
16+
17+
In this example we specify that we want code to appear collapsed by default. There are YAML options to control many other aspects of document rendering. See the documentation on [Authoring](/docs/authoring/markdown-basics.qmd) and [Output Formats](/docs/output-formats/html-basics.qmd) for additional details.
18+
19+
## Markdown Cells
20+
21+
Here's the underlying code for the markdown cell:
22+
23+
![](images/vscode-markdown.png){.border fig-alt="A snippet of an ipynb document containing a Markdown cell. The cell contains some text written in Markdown."}
24+
25+
Note that a Quarto cross-reference (`@fig-polar`) is included in the markdown. Any valid Pandoc markdown syntax can be included in markdown cells.
26+
27+
## Output Options
28+
29+
Quarto uses leading comments with a special prefix (`#|`) to denote cell options. Here we specify the `label` and `fig-cap` options so that the plot generated from the cell can be cross-referenced.
30+
31+
![](images/vscode-cell-options.png){.border fig-alt="A snippet of a JupyterLab document containing a code cell. At the top of cell, before the code, are the Quarto chunk options '#| label: fig-polar' and '#| fig-cap: A line plot on a polar axis.'"}
32+
33+
Note that options must appear at the very beginning of the cell. As with document front-matter, option names/values use YAML syntax.
34+
35+
There are many output options available, including options to optionally hide code, warnings, and/or output. See the documentation on [Output Options](/docs/computations/execution-options.qmd#output-options) for additional details.
36+
37+
## Cell Execution
38+
39+
{{< include ../computations/_jupyter-execute.md >}}
40+
41+
There are many other execution options available (e.g. to control caching, optimizing kernel start-up time, etc.). Learn more about these options in [Execution Options](/docs/computations/execution-options.qmd).
42+
43+
## Converting Notebooks
44+
45+
You can convert between .ipynb and .qmd representations of a notebook using the `quarto convert` command. For example:
46+
47+
``` {.bash filename="Terminal"}
48+
quarto convert basics-jupyter.ipynb
49+
quarto convert basics-jupyter.qmd
50+
```
51+
52+
See `quarto convert help` for additional details on converting notebooks.

docs/tools/_examples/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.html
2+
*_files/

docs/tools/_examples/palmer-penguins.ipynb

Lines changed: 86 additions & 0 deletions
Large diffs are not rendered by default.
704 KB
Loading

docs/tools/positron-notebook.qmd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Positron Notebook Editor
3+
tool:
4+
name: Positron
5+
image-prefix: images/positron
6+
---
7+
8+
{{< include _code-oss_notebook.md >}}

docs/tools/vscode-notebook.qmd

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,8 @@
11
---
22
title: VS Code Notebook Editor
3+
tool:
4+
name: VS Code
5+
image-prefix: images/vscode
36
---
47

5-
In addition to editing Quarto documents as plain-text `.qmd` files, you can also use the VS Code Notebook Editor to author `.ipynb` notebooks that are rendered with Quarto. In this article we'll review the basics of editing `.ipynb` notebooks for use with Quarto.
6-
7-
8-
## Render and Preview
9-
10-
The basic workflow for editing notebooks for use with Quarto is identical to the workflow for `.qmd` files. Edit the file and then execute the **Quarto: Preview** command (you can alternatively use the <kbd>Ctrl+Shift+K</kbd> keyboard shortcut). You'll see a preview of the published page side by side with the notebook:
11-
12-
![](images/vscode-notebook.png){.border}
13-
14-
After you've done an initial **Quarto: Preview**, the preview will automatically update every time you save the notebook.
15-
16-
## YAML Front Matter
17-
18-
The first cell of your notebook should be a **Raw** cell that contains the document title, author, and any other options you need to specify. Note that you can switch the type of a cell to **Raw** using the cell type menu at the bottom right of the cell:
19-
20-
![](images/vscode-raw.png){.border fig-alt="The top section of an ipynb file open in VSCode. There is a Raw cell containing yaml front matter."}
21-
22-
In this example we specify that we want code to appear collapsed by default. There are YAML options to control many other aspects of document rendering. See the documentation on [Authoring](/docs/authoring/markdown-basics.qmd) and [Output Formats](/docs/output-formats/html-basics.qmd) for additional details.
23-
24-
## Markdown Cells
25-
26-
Here's the underlying code for the markdown cell:
27-
28-
![](images/vscode-markdown.png){.border fig-alt="A snippet of an ipynb document containing a Markdown cell. The cell contains some text written in Markdown."}
29-
30-
Note that a Quarto cross-reference (`@fig-polar`) is included in the markdown. Any valid Pandoc markdown syntax can be included in markdown cells.
31-
32-
## Output Options
33-
34-
Quarto uses leading comments with a special prefix (`#|`) to denote cell options. Here we specify the `label` and `fig-cap` options so that the plot generated from the cell can be cross-referenced.
35-
36-
![](images/vscode-cell-options.png){.border fig-alt="A snippet of a JupyterLab document containing a code cell. At the top of cell, before the code, are the Quarto chunk options '#| label: fig-polar' and '#| fig-cap: A line plot on a polar axis.'"}
37-
38-
Note that options must appear at the very beginning of the cell. As with document front-matter, option names/values use YAML syntax.
39-
40-
There are many output options available, including options to optionally hide code, warnings, and/or output. See the documentation on [Output Options](/docs/computations/execution-options.qmd#output-options) for additional details.
41-
42-
## Cell Execution
43-
44-
{{< include ../computations/_jupyter-execute.md >}}
45-
46-
There are many other execution options available (e.g. to control caching, optimizing kernel start-up time, etc.). Learn more about these options in [Execution Options](/docs/computations/execution-options.qmd).
47-
48-
## Converting Notebooks
49-
50-
You can convert between .ipynb and .qmd representations of a notebook using the `quarto convert` command. For example:
51-
52-
``` {.bash filename="Terminal"}
53-
quarto convert basics-jupyter.ipynb
54-
quarto convert basics-jupyter.qmd
55-
```
56-
57-
See `quarto convert help` for additional details on converting notebooks.
8+
{{< include _code-oss_notebook.md >}}

0 commit comments

Comments
 (0)