executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
751 stars 197 forks source link

Issue on page /syntax/tables.html #944

Closed RunningLeon closed 3 months ago

RunningLeon commented 3 months ago

Hi, I follow the table example , but cannot get the table correctly: error log when build HTML with make html command:

source/test.md:3: ERROR: Error parsing content block for the "table" directive: exactly one table expected.

<table border="1" class="docutils">
<thead>
<tr>
<th>foo</th>
<th>bar</th>
</tr>
</thead>
<tbody>
<tr>
<td>baz</td>
<td>bim</td>
</tr>
</tbody>
</table>

test.md original content (not work)

# Test table

:::{table} Table caption
:widths: auto
:align: center

| foo | bar |
| --- | --- |
| baz | bim |

:::

output HTML page(without table)

image

test.md formated by mdformat(not work)

# Test table

:::\{table} Table caption
:widths: auto
:align: center

| foo | bar |
| --- | --- |
| baz | bim |

:::

output HTML page(rendered badly)

image

index.rst content

.. samplecode documentation master file, created by
   sphinx-quickstart on Thu Jul 11 11:42:27 2024.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to samplecode's documentation!
======================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:

   source/test.md

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

conf.py content

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'samplecode'
copyright = '2024, LM'
author = 'LM'
release = '0.0.1'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ['_templates']
exclude_patterns = []

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_book_theme'
html_static_path = ['_static']
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'sphinx.ext.napoleon',
    'sphinx.ext.viewcode',
    'sphinx.ext.autosectionlabel',
    'sphinx.ext.intersphinx',
    'sphinx_tabs.tabs',
    'sphinx_markdown_tables',
    'myst_parser',
    'sphinx_copybutton',
    'sphinxcontrib.mermaid',
]  # yapf: disable

# Enable ::: for my_st
myst_enable_extensions = [
    'dollarmath',
    'amsmath',
    'deflist',
    # "html_admonition",
    # "html_image",
    'colon_fence',
    # "smartquotes",
    # "replacements",
    # "linkify",
    # "substitution",
]
myst_heading_anchors = 5

# Custom s

package versions

pydata-sphinx-theme           0.15.4
sphinx-book-theme             1.1.3
sphinx-copybutton             0.5.2
sphinx-markdown-tables        0.0.17
sphinx_pyscript               0.1.0
sphinx-tabs                   3.4.5
sphinx_tippy                  0.4.3
sphinx-togglebutton           0.3.2
sphinxcontrib-applehelp       1.0.8
sphinxcontrib-devhelp         1.0.6
sphinxcontrib-htmlhelp        2.0.5
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-mermaid         0.9.2
sphinxcontrib-qthelp          1.0.7
sphinxcontrib-serializinghtml 1.1.10
myst-parser                   3.0.1
mdformat                      0.7.17
mdformat_frontmatter          2.0.1
mdformat_myst                 0.1.5
mdformat_tables               0.4.1

python

Python 3.10.14
RunningLeon commented 3 months ago

Fixed by removing sphinx_markdown_tables extension in conf.py

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'sphinx.ext.napoleon',
    'sphinx.ext.viewcode',
    'sphinx.ext.autosectionlabel',
    'sphinx.ext.intersphinx',
    'sphinx_tabs.tabs',
   #  'sphinx_markdown_tables',
    'myst_parser',
    'sphinx_copybutton',
    'sphinxcontrib.mermaid',
]  # yapf: disable