Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🏷️ Change tags type to match jupytext #1780

Merged
merged 3 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/execute-notebooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Here's an example of adding this tag with a {myst:directive}`code-cell` directiv

````markdown
```{code-cell}
:tags: raises-exception
:tags: [raises-exception]

print("Hello" + 10001)
```
Expand All @@ -57,7 +57,7 @@ For [Markdown notebooks using the {myst:directive}`code-cell` directive](noteboo

````markdown
```{code-cell}
:tags: skip-execution
:tags: [skip-execution]

name = input("What is your name?")
```
Expand Down
13 changes: 12 additions & 1 deletion docs/notebook-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,22 @@ In Markdown of a jupyter notebook these look like:

````markdown
```{code-cell} python
:tags: remove-input
:tags: [remove-input]
print("This will show output with no input!")
```
````

for a single tag, or

````markdown
```{code-cell} python
:tags: [my-tag1, my-tag2]
print("This will show output with no input!")
```
````

for any number of tags.

:::{table} Notebook cell tags with special meanings
:label: tbl:notebook-cell-tags

Expand Down
10 changes: 5 additions & 5 deletions docs/notebooks-with-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,22 @@ For example, the following code defines a `remove-input` tag (See all [notebook

````markdown
```{code-cell} python
:tags: remove-input
:tags: [remove-input]
print("This will show output with no input!")
```
````

and results in the following:

> ```{code-cell} python
> :tags: remove-input
> :tags: [remove-input]
> print("This will show output with no input!")
> ```

This can be particularly helpful for showing the output of a calculation or plot, which is reproducible in the {download}`source code <./notebooks-with-markdown.md>`, but not shown to the user like this `matplotlib` plot:

```{code-cell} python
:tags: remove-input
:tags: [remove-input]
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
Expand All @@ -149,12 +149,12 @@ plt.show()

For **multiple tags** you have two ways to provide them:

- If you specify argument options with `:`, tags will be parsed as a comma-separated string.
- If you specify argument options with `:`, tags will be parsed as a comma-separated list of strings.
For example:

````markdown
```{code-cell} python
:tags: tag1, tag2,tag3
:tags: [tag1, tag2,tag3]
# Note that whitespace is removed from tags!
print("howdy!")
```
Expand Down
Loading