Given a jupyter notebook (here Test_Export.ipynb) with the following content:
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"This is markdown."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print('This is code.')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
I’d like to export the executed notebook without input code to asciidoc format. In order to do that, I use the offical docker image and execute:
docker run --rm -it --entrypoint /bin/bash -P -v ${PWD}:/home/jovyan/ jupyter/minimal-notebook:notebook-6.5.4 -c "jupyter nbconvert --execute --to asciidoc --no-input Test_Export.ipynb"
The result looks as follows:
----
This is code.
----
Somehow any markdown area is completely omitted which is the case for base-notebook image and minimal-notebook one. Using datascience-notebook image, the markdown sections are correctly exported to the asciidoc file.
Why is that?
2
Answers
As mentioned by Wayne in the comments, the problem refers to the version of
nbconvert
. It seems that versions above 7.5.0 have this problem, so I switched to the following image:This one contains version 7.4.0 and exports the notebook to asciidoc format successfully.
To omit the input code, simply do the following.
What is the purpose of your docker container here? It seems irrelevant to the question.