Skip to content

Handling of indented fenced input/output code blocks (e.g. within an itemize) #33

@nthiery

Description

@nthiery

Markdown supports fenced code blocks within itemize or other markdown construct denoted by indentation, as in the following example:

# Test file for notedown's handling of indented fenced code blocks

Those may typically occur within an itemize or so.

Normal fenced input/output code blocks:
```{.python .input}
1+1
```
```{.json .output}
[{"execution_count": 1, "output_type": "execute_result", "data": {"text/plain": "2"}, "metadata": {}}]
```

1.  Start of an itemize  
    Indented fenced input/output code blocks

    ```{.python .input}
    1+1
    ```
    ```{.json .output}
    [{"execution_count": 1, "output_type": "execute_result", "data": {"text/plain": "2"}, "metadata": {}}]
    ```

    Some more:

    ```{.python .input}
    1+1
    ```
    ```{.json .output}
    [{"execution_count": 1, "output_type": "execute_result", "data": {"text/plain": "2"}, "metadata": {}}]
    ```

1.  Next item (should be numbered 2.)

Would it be possible to have notedown support them as well? In particular, is there a way to translate such code blocks in the Jupyter notebook model?

Currently notedown gets confused and treat the the fenced code blocks and everything indented after as a single raw codeblock. I tried the different values of --match without success.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions