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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Markdown] Table within list doesn't render correctly #3501

Closed
ajeetdsouza opened this issue Apr 8, 2021 · 3 comments · Fixed by #3506
Closed

[Markdown] Table within list doesn't render correctly #3501

ajeetdsouza opened this issue Apr 8, 2021 · 3 comments · Fixed by #3506
Labels
A-backend ⚙️ C-bug 🐞 Category: unintended, undesired behavior

Comments

@ajeetdsouza
Copy link

In the README of my crate, a Markdown table placed under a list element doesn't render correctly, even with the correct indentation. This works fine on GitHub, and it would be nice if crates.io was able to support this too.

For context, look at the Environment Variables section in both of these:


The following is an example of a table within a list in Markdown:

- Root 1
  - Item 1
  - Item 2:
    | OS          | Path                                     | Example                                    |
    | ----------- | ---------------------------------------- | ------------------------------------------ |
    | Linux / BSD | `$XDG_DATA_HOME` or `$HOME/.local/share` | `/home/alice/.local/share`                 |
    | macOS       | `$HOME/Library/Application Support`      | `/Users/Alice/Library/Application Support` |
    | Windows     | `{FOLDERID_RoamingAppData}`              | `C:\Users\Alice\AppData\Roaming`           |

It should render this way:

  • Root 1
    • Item 1
    • Item 2:
      OS Path Example
      Linux / BSD $XDG_DATA_HOME or $HOME/.local/share /home/alice/.local/share
      macOS $HOME/Library/Application Support /Users/Alice/Library/Application Support
      Windows {FOLDERID_RoamingAppData} C:\Users\Alice\AppData\Roaming
@plaets
Copy link
Contributor

plaets commented Apr 8, 2021

Looks like this could be a bug in comrak, the markdown library used by crates.io.

You can test this by installing comrak using cargo install comrak and then running something like
cat README.md | comrak -e autolink -e strikethrough -e table -e tagfilter -e tasklist --unsafe --header-ids user-content-
to manually render your readme to html (options from src/render.rs). The relevant part of the result should look like this
image
Full output here

If you want a temporary fix, adding a newline between the list element and the table seems to work. Although it looks like it also slightly changes the formatting.
fixed readme
image

@ajeetdsouza
Copy link
Author

@plaets thanks for the quick reply, I've created an issue here: kivikakk/comrak#182.

@kivikakk
Copy link
Contributor

kivikakk commented Apr 9, 2021

Hi! I've released 0.10.1-rc.1 which fixes this issue. Sorry for the rc but I just don't have the time for a full release right now. This specifically fixes this issue, per the same change made in upstream cmark-gfm.

@Turbo87 Turbo87 added A-backend ⚙️ C-bug 🐞 Category: unintended, undesired behavior labels Apr 9, 2021
bors added a commit that referenced this issue Apr 12, 2021
Upgrade `comrak` dependency

Fixes #3501 by upgrading comrak to an rc version. See the issue for more detalis.
@bors bors closed this as completed in 7b7d72e Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-bug 🐞 Category: unintended, undesired behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants