Skip to content

Pipe character in rustdoc markdown tables can not be escaped #27862

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

Closed
m4rw3r opened this issue Aug 17, 2015 · 4 comments · Fixed by #27945
Closed

Pipe character in rustdoc markdown tables can not be escaped #27862

m4rw3r opened this issue Aug 17, 2015 · 4 comments · Fixed by #27945
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@m4rw3r
Copy link
Contributor

m4rw3r commented Aug 17, 2015

Attempting to use the pipe symbol in tables in doc-comments does not work as it will be interpreted as a table-separator even when attempting to escape it. Attempts to use html-entities also fails (ie. |) and they end up escaped.

Example:

Test  | Table
------|-----------
t = b | id = |x| x

This causes only f = to be rendered in the right cell instead of the expected f = |x| x.

Looking at Hoedown it seems like they fixed this in commit hoedown/hoedown@e7bcbe3 , which would enable us to write this:

Test  | Table
------|-------------
t = b | id = \|x\| x
@alexcrichton
Copy link
Member

I think all we probably need to do here is update the hoedown submodule and double-check the FFI bindings didn't change, other than that it should just work after that!

@alexcrichton alexcrichton added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Aug 17, 2015
@ghost ghost mentioned this issue Aug 22, 2015
bors added a commit that referenced this issue Aug 25, 2015
Some hoedown FFI changes:
- `HOEDOWN_EXT_NO_INTRA_EMPHASIS` constant changed.
- Updated/tidied up all callback function signatures.
- All opaque data access has an additional layer of indirection for some reason (`hoedown_renderer_data`).

This also fixes #27862.
@greyblake
Copy link

In 2023, I seem still to experience this issue.

@vallentin
Copy link
Contributor

I just encountered this as well, which confused me, as it is mentioned in the rustdoc book

@vallentin
Copy link
Contributor

Correction. In my case, it rendered incorrectly due to pulldown-cmark not supporting tables being indented.

Issue: pulldown-cmark/pulldown-cmark#656

E.g. if I had the following doc comment:

//! Foo
//!
//! | A | B |
//! |---|---|
//! | 1 | 2 |

Then the table renders correctly:

image

However, if the table is indented, then it renders as plain text. This can occur if another line is not indented correctly, e.g.:

//!Foo
//!
//! | A | B |
//! |---|---|
//! | 1 | 2 |

Notice how Foo is not indented with 1 space. Thus the table is indented by 1 space relative to the "Foo" text. This caused the table to render incorrectly for me:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants