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

Help getting markdown table working #351

Closed
dadatawajue opened this issue Apr 29, 2017 · 2 comments
Closed

Help getting markdown table working #351

dadatawajue opened this issue Apr 29, 2017 · 2 comments
Labels

Comments

@dadatawajue
Copy link

Hi, I'm trying to figure out how to use this library but it does not seem to be working, not sure if I'm doing something wrong.. This is the input I feed using a HTML textarea:

FINALS:
| Match URL | PlayerX |   | Player Y |
| - | - | - | - |
| [Match 1](someurl.com) | foo | vs | bar |
| [Match 2](someurl.com) | foo | vs | bar |
| [Match 3](someurl.com) | foo | vs | bar |
------
SEMI-FINALS:
| Match URL | PlayerX |   | Player Y |
| - | - | - | - |
| [Match 1](someurl.com) | foo | vs | baz |
| [Match 2](someurl.com) | foo | vs | baz |
| [Match 3](someurl.com) | foo | vs | baz |

Then in Go I get and print it like this:

unsafe := blackfriday.MarkdownCommon([]byte(r.FormValue("content")))
mdContent := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
log.Println(string(mdContent))

But the result mysteriously ends up like this rather than a table:

<p>FINALS:
| Match URL | PlayerX |   | Player Y |
| - | - | - | - |
| <a href="someurl.com" rel="nofollow">Match 1</a> | foo | vs | bar |
| <a href="someurl.com" rel="nofollow">Match 2</a> | foo | vs | bar |
| <a href="someurl.com" rel="nofollow">Match 3</a> | foo | vs | bar |

<hr/>

<p>SEMI-FINALS:
| Match URL | PlayerX |   | Player Y |
| - | - | - | - |
| <a href="someurl.com" rel="nofollow">Match 1</a> | foo | vs | baz |
| <a href="someurl.com" rel="nofollow">Match 2</a> | foo | vs | baz |
| <a href="someurl.com" rel="nofollow">Match 3</a> | foo | vs | baz |</p>
@dmitshur
Copy link
Collaborator

From https://help.github.com/articles/organizing-information-with-tables/:

There must be at least three hyphens in each column of the header row.

Try this:

| Match URL | PlayerX |   | Player Y |
| --- | --- | --- | --- |
| [Match 1](someurl.com) | foo | vs | bar |
| [Match 2](someurl.com) | foo | vs | bar |
| [Match 3](someurl.com) | foo | vs | bar |

@dadatawajue
Copy link
Author

Oh, that works.. seems I also had to create an extra newline between 'FINALS' and the table. Thanks a lot :)

Beanow added a commit to teamopen-dev/workgroups that referenced this issue Sep 27, 2019
See russross/blackfriday#351
While github accepts "-|-|-" as the second row,
github specified this is incorrect and blackfriday follows
the the requirement for this to have 3+ hyphens.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants