diff --git a/doc/markdown-cells.ipynb b/doc/markdown-cells.ipynb index d7d906b5..54a10a53 100644 --- a/doc/markdown-cells.ipynb +++ b/doc/markdown-cells.ipynb @@ -23,16 +23,47 @@ "* Green\n", "* Blue\n", "\n", - "Note: JupyterLab and JupyterNotebook uses a different Markdown parser than nbsphinx (which currently uses Pandoc). \n", - "In case that your Bulletpoints do render in the notebook and do not render with nbsphinx, please add one blank line before the bulletpoints.\n", - "***\n", + "JupyterLab and JupyterNotebook use a different Markdown parser than nbsphinx\n", + "(which currently uses Pandoc). When using Pandoc v2.0 or later, nbsphinx uses\n", + "GitHub-flavored markdown, this is the same standard of markdown used by\n", + "JupyterLab and JupyterNotebook.\n", "\n", + "In particular, newer versions of nbsphinx (>v0.9.5) will now correctly convert\n", + "lists without a blank line:\n", + "\n", + "```markdown\n", + "No new line before this list:\n", + "1. One\n", + "2. Two\n", + "3. Three\n", + "```\n", + "No new line before this list:\n", "1. One\n", - "1. Two\n", - "1. Three\n", + "2. Two\n", + "3. Three\n", + "\n", + "\n", + "Arbitrary Unicode characters should be supported, e.g. łßō. Note, however, that\n", + "this only works if your HTML browser and your LaTeX processor provide the\n", + "appropriate fonts." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Task Lists\n", "\n", - "Arbitrary Unicode characters should be supported, e.g. łßō.\n", - "Note, however, that this only works if your HTML browser and your LaTeX processor provide the appropriate fonts." + "nbsphinx supports GitHub-style task lists:\n", + "\n", + "```\n", + "- [x] Task 1\n", + "- [ ] Task 2\n", + "- [ ] Task 3\n", + "```\n", + "- [x] Task 1\n", + "- [ ] Task 2\n", + "- [ ] Task 3" ] }, { diff --git a/src/nbsphinx/__init__.py b/src/nbsphinx/__init__.py index a7cd99c1..ef47dd97 100644 --- a/src/nbsphinx/__init__.py +++ b/src/nbsphinx/__init__.py @@ -1039,13 +1039,22 @@ def filter_func(text): json_data = json.loads(text, object_hook=object_hook) return json.dumps(json_data) - input_format = 'markdown' - input_format += '-implicit_figures' v = nbconvert.utils.pandoc.get_pandoc_version() - if nbconvert.utils.version.check_version(v, '1.13'): - input_format += '-native_divs+raw_html' if nbconvert.utils.version.check_version(v, '2.0'): - input_format += '-smart' # Smart quotes etc. are handled by Sphinx + """Accodring to https://nbformat.readthedocs.io/en/latest/format_description.html#markdown-cells + the kind of markdown used by jupyter is github flavored markdown (gfm). + + The gfm extension was added in 2.0 + (https://pandoc.org/releases.html#pandoc-2.0-2017-10-29). + """ + input_format = 'gfm-smart' + else: + input_format = 'markdown' + input_format += '-implicit_figures' + if nbconvert.utils.version.check_version(v, '1.13'): + input_format += '-native_divs+raw_html' + if nbconvert.utils.version.check_version(v, '2.0'): + input_format += '-smart' # Smart quotes etc. are handled by Sphinx rststring = pandoc(text, input_format, 'rst', filter_func=filter_func) rststring = re.sub(