Table not render when use Redcarpet in Jekyll GitHub Pages?
Asked Answered
L

5

35

As of maruku engine (the default), writing table like

surround text, etc.

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |

surround text...

would render correctly.

But when I switch to redcarpet (add markdown: redcarpet into _config.yml), the table no longer rendered, both localhost and on GitHub Pages.

Did I do something wrong?

Labannah answered 19/4, 2013 at 7:11 Comment(1)
no, that topic is not relate to jekyll, but it does gives me some hint.Labannah
L
64

Adding only markdown: redcarpet into _config.yml is not enough, It's also need the extensions part, e.g.

markdown: redcarpet
redcarpet:
  extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "tables", "with_toc_data"]
Labannah answered 21/4, 2013 at 0:46 Comment(1)
from the Jekyll documentation: jekyllrb.com/docs/configuration/#redcarpet And theese are the Redcarpet extensions, from the Readme : git.io/Xk0CQQFluorinate
C
6

For this question, it seems the important extension here is "tables".

However if you want more Github flavored markdown, there are a few more listed at http://sholsinger.com/2014/03/jekyll-github-flavored-markdown.

Combining with neizod's answer I ended up using.

markdown: redcarpet
redcarpet:
  extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "tables", "strikethrough", "superscript", "with_toc_data"]
Coadjutor answered 23/1, 2015 at 16:44 Comment(0)
H
2

The redcarpet markdown engine is no longer supported by GitHub Pages and may cease working at any time.

A very straightforward solution is to delete the markdown setting in site's _config.yml file and instead have an extra line between the headline/text and the table.

You can get more information from github help and this solution was taken from this issue.

Hermosa answered 15/10, 2017 at 8:32 Comment(0)
D
0

How to render table with Redcarpet and Markdown

Also, I can confirm Kramdown will do this.

Denice answered 19/4, 2013 at 9:30 Comment(0)
B
0

For anyone still running into this years later here's an example of how to fix it.

If your markdown is like this:

# My Favorite Books 
| Title | Description |
| ----- | ----------- |
| Attack Surface | A sci-fi book by Cory Doctorow showing how currently available tech can be used to oppress | 

It will render fine on github.org but fail to render on github pages.

The solution is to ass a blank line above you table like so:

# My Favorite Books 

| Title | Description |
| ----- | ----------- |
| Attack Surface | A sci-fi book by Cory Doctorow showing how currently available tech can be used to oppress | 

Thanks to LTChen's answer for putting me on the right track.

Boffa answered 15/3, 2021 at 22:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.