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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicts when parsing tables #4

Closed
frank-lenormand opened this issue Sep 19, 2023 · 3 comments
Closed

Conflicts when parsing tables #4

frank-lenormand opened this issue Sep 19, 2023 · 3 comments

Comments

@frank-lenormand
Copy link

Hi,

I use badges and tables in my documentation:

|badge_name|value|class_name|
| 馃敆 | information (count) | grouping |
| - | ------------------- | :------: |
| [馃敆](#foo) | server |

When the site builds, the above results in the following warnings:

WARNING -  [badges] [a.md:1] Parsing error: Unknown attribute: ' grouping '
WARNING -  [badges] [a:2] Parsing error: Unknown attribute: ' :------: '

Is there any way to make parsing more robust, and avoid producing those false negatives?

Note that the same warnings show up when the table has more than 3 columns, which is an easier case to handle in my opinion.

Further: handling badges in tables.

Thanks!

@six-two
Copy link
Owner

six-two commented Sep 24, 2023

Hi,

thanks for the bug report! I will look into the issue.

I know that tables were tricky, which is why I added a test table to one of the test pages (source/rendered). My guess is, that my table detection logic does not recognize your table header row:

| - | ------------------- | :------: |

Sadly I can not rely on a set maximum length, since you can define badges like this one:

|with properties 1|test|c:text to copy|l:https://example.com|.html-class|class:html-class2|

Personally I always use at least three dashes and have not yet needed to the alignment settings (like :---:). I will try to make the parsing more robust and add an option to disable warnings from the plugin.

@six-two
Copy link
Owner

six-two commented Sep 24, 2023

The problem was the single dash. I was under the assumption, that three or more dashes were needed for every field in the row between table header and body. The regex has been adjusted, and your problematic table now works for me (see latest tests). Can you please update the plugin to version 0.4.2 and tell me if you have any more broken tables?

By the way: By adding disable_warnings: True to the plugin config in your mkdocs.yml, you can also disable warnings. But I would not recommend it, since it can hide real issues. In your case the warnings were actually useful, since the third line (with the link and server text) was actually parsed as a badge before this fix.

@frank-lenormand
Copy link
Author

Seems to work, thanks for the quick fix!

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

No branches or pull requests

2 participants