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

Complex cell attributes support in Pandoc Jupyter Markdown #5992

Open
kiwi0fruit opened this issue Dec 15, 2019 · 1 comment
Open

Complex cell attributes support in Pandoc Jupyter Markdown #5992

kiwi0fruit opened this issue Dec 15, 2019 · 1 comment

Comments

@kiwi0fruit
Copy link

kiwi0fruit commented Dec 15, 2019

Sometimes Jupyter needs to have complex cell attributes like in celltags extension (that would be merged into jupyterlab in the near future):

{
    "tags": [
        "test",
        "main"
    ]
}

But there is no info in Creating Jupyter notebooks with pandoc section of Pandoc manual on how to add such cell metadata.

If it's possible to do then this issue is about adding info how to do it to the manual.

If it's not possible to do then this issue is about adding such functionality to Pandoc.

UPD: this actually adds metadata to the output ipynb document:

``` {.python .cell .code dic="{\"main\":\"2\",\"test\":\"1\"}" tags="[\"test\",\"main\"]"}
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.random(16).reshape(4, 4))
df
```

Title
=====

Text and tbl. 2

and corresponds to the following Cell Metadata:

{
    "tags": [
        "test",
        "main"
    ],
    "dic": {
        "test": "1",
        "main": "2"
    }
}
@kiwi0fruit
Copy link
Author

By the way. The way cell metadata is stored can be more user-friendly: store json in yaml. Like in this example:

::: {.cell .markdown .cellmeta}
```yaml
slideshow:
  slide_type: slide
```
# Header

* list
* list
:::

Or

::: {.cell .code .cellmeta}
```yaml
slideshow:
  slide_type: slide
```
```python
print(123)
```
:::

.cellmeta class means that the first yaml code block inside div stores cell metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants