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

rmarkdown to html: tables do not render if + or - present in header row #2765

Closed
oliverdrechsel opened this issue Mar 9, 2016 · 6 comments
Closed

Comments

@oliverdrechsel
Copy link

As soon as one puts strings ending with '+' or '-' in the header of tables, they will not render as table, but as normal text, in html.

The issue was described with example data here:
http://stackoverflow.com/questions/35798605/how-to-markdown-html-tables-containing-plus-minus

@jgm
Copy link
Owner

jgm commented Mar 9, 2016

Example from linked post:

|               | IP_gene8-_1st| IP_gene8+_1st| 
|:--------------|-------------:|-------------:|
|IP_gene8-_1st  |     1.0000000|     0.4357325|
|IP_gene8+_1st  |     0.4357325|     1.0000000|

@jgm
Copy link
Owner

jgm commented Mar 9, 2016

Minimal cases:

| a-_b |
|------|
| 1    |
| a+_b |
|----|
|  1|

@jgm
Copy link
Owner

jgm commented Mar 9, 2016

Interestingly revealing case:

pandoc -t native
| a |
|----| 
| a+_b |
| 1 |
^D
[Table [] [AlignDefault] [0.0]
 [[Plain [Str "a"]]]
 [[[Plain [Str "a+_b",Space,Str "|",SoftBreak,Str "|",Space,Str "1",Space,Str "|"]]]]]

@jgm
Copy link
Owner

jgm commented Mar 9, 2016

Workaround until the bug is fixed: escape the _ characters as \_.

@jgm
Copy link
Owner

jgm commented Mar 9, 2016

Note also that pandoc allows + as well as | as a pipe separator. (This is to achieve compatibility with org-mode tables, which are easy to create in Emacs.)

So literal + characters should be backslash-escaped.

@oliverdrechsel
Copy link
Author

I tried a bit more and it seems the \_ is necessary to get a valid html table.

a+_b doesn't work
a\+_b doesn't work
a+\_b works
a+b works

jgm added a commit that referenced this issue Mar 9, 2016
Previously an emph element could be parsed across the newline
at the end of the pipe table row.

I thought this would help with #2765, but it doesn't.
@jgm jgm closed this as completed in 2b55b76 Mar 9, 2016
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