Skip to content

Issue executing Python cells with cell magic plus code block options  #578

@c-zippel

Description

@c-zippel

First, thank you for creating this amazing tool.

I'm having trouble rendering Quarto documents that include a Python cell with both cell magic and code block options. Cells with cell magic and no options execute just fine. However, cells with both cell magic and options do not execute. (Line magic works fine whether or not there are options.)

As an example, if I attempt to render this document:

---
title: "Cell Magic"
format: html
jupyter: python3
---

## Cell magic without code block options

```{python}
%%html
<span>Something</span>
```

## Cell magic with code block options

```{python}
#| echo: false

%%html
<span>Something else</span>
```

I see this error message:

Executing 'try_cell_magic.ipynb'
  Cell 1/2...Done
  Cell 2/2...ERROR: 

An error occurred while executing the following cell:
------------------
#| echo: false

%%html
<span>Something else</span>
------------------

  Input In [8]
    <span>Something else</span>
    ^
SyntaxError: invalid syntax

SyntaxError: invalid syntax (3512398949.py, line 3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions