ryanfox / sphinx-markdown-tables

A markdown table plugin for Sphinx
GNU General Public License v3.0
59 stars 15 forks source link

Can not rendering table if there are some white characters in the previous line #29

Open JunweiSUN opened 4 years ago

JunweiSUN commented 4 years ago

Hi, thanks for this amazing work!

Now I have some trouble about a rendering issue. For example, if I want to render a table like this:

aaa bbb aaa ddd
1 2 3 4

It could be rendered normally. However, if there are some white characters in the previous line like:

aaa bbb aaa ddd
1 2 3 4

Then this table cannot be rendered normally, even if I use the latest version of sphinx-markdown-tables. But it can be rendered in github, please refer to the raw markdown code. I'm using crowdin to generate docs automaticlly, so it is difficult for me to remove the white spaces by hand. I found #26 seems similar to this issue. I'd appreciate it if you could check this for me. I use the following version of sphinx:

sphinx==1.8.3
sphinx-argparse==0.2.5
sphinx-markdown-tables==0.0.9
sphinx-rtd-theme==0.4.2
sphinxcontrib-websupport==1.1.0
recommonmark==0.5.0
ryanfox commented 4 years ago

I'm afraid your two examples look the same, so it's hard to tell exactly what the problem is.

Version 0.0.9 is pretty old, and issue #26 was resolved. If you can confirm that the issue still exists with the latest release and post an example, I can help diagnose the problem.

JunweiSUN commented 4 years ago

Hi @ryanfox, thanks for the reply! The difference between the two tables is that the second table's has a line above the with white spaces which resulting to render error in sphinx. Like this:


|aaa|bbb|aaa|ddd|
|---|---|---|---|
|1|2|3|4|

Github can render both situation (w/ or w/o whitespace), but it seems that sphinx can not handle the latter situation. I'm not sure if this is caused by sphinx's markdown interpreter or sphinx-markdown-tables. I upgraded to the latest version and the problem seems still exists. I'd appreciate it if you could check this for me.

avinashvarna commented 3 years ago

I ran into a similar issue.

Essentially, this extension expects a blank line before the table (i.e. at least 2 newlines) :https://github.com/ryanfox/sphinx-markdown-tables/blob/0cf1398a33313124a1e439db693228ada9b4cbe2/sphinx_markdown_tables/__init__.py#L27

So a table without a blank line preceding it will not be detected. GH/Gitlab markdown renderers seem to be ok with not having a blank line before the table.