11

I'm writing document with Jekyll/Markdown and its engine is kramdown.
And now I'm wondering the way to write lists in table built by markdown.

I tried following.

|Name   |Columns             |
|-------|--------------------|
|PRIMARY|<ul><li>id</li></ul>|

In GitHub's Gist, it's rendered as I thought.

But in Jekyll (my local one or GitHub Pages' one), it's not.
http://yuya-takeyama.github.io/2011/10/08/hello-github-pages.html

Is there any way to write lists in table in Jekyll?
I'll replace markdown engine if it's required.

Yuya Takeyama
  • 111
  • 1
  • 4

5 Answers5

10

nomarkdown tag helps:

|Name   |Columns                               |
|-------|--------------------------------------|
|PRIMARY|{::nomarkdown}<ul><li>id</li></ul>{:/}|

Jekyll rendered table

The solution works with both kramdown and redcarpet.

user2291296
  • 334
  • 3
  • 11
3

As we known, Jekyll uses kramdown as a default markdown converter from 2.0+. And It doesn't support the table cell alignment, merging and so on, I think the below can help you.

jekyll-spaceship - A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, youtube, vimeo, dailymotion, etc.

https://github.com/jeffreytse/jekyll-spaceship

For now, these extended features are provided:

  • Cells spanning multiple columns
  • Cells spanning multiple rows
  • Cells text align separately
  • Table header not required
  • Grouped table header rows or data rows

Markdown:

table code

Code above would be parsed as:

html table

J.T.
  • 864
  • 9
  • 17
2

I think Kramdown doesn't support multiline tables, and no HTML in table cells either (although I'm no Kramdown expert).

However, Pandoc has a few different table syntaxes, among them:

+---------+----------+
| Name    | Columns  |
+=========+==========+
| PRIMARY | - id one |
|         | - id two |
+---------+----------+

You can use, this plugin to use Pandoc from Jekyll. Note, that you'll have to run Jekyll locally since GitHub doesn't support Jekyll plugins.

Community
  • 1
  • 1
mb21
  • 34,845
  • 8
  • 116
  • 142
2

This seems to maximize GitHub Markdown compatibility:

markdown: redcarpet
redcarpet:
  extensions:
    - no_intra_emphasis
    - fenced_code_blocks
    - autolink
    - tables
    - strikethrough
    - superscript
    - with_to_data

The extension addressing your question is tables, but you probably want the rest if you want your Gists to look like your pages for the same markup.

approxiblue
  • 6,982
  • 16
  • 51
  • 59
  • 1
    Unfortunately, GitHub Pages doesn't support *redcarpet* anymore, so you have to build the Jekyll Pages by yourself for this solution. – biolauri Sep 05 '19 at 12:32
-3
  1. Open _config.yml
  2. Add markdown: kramdown
  3. Run jekyll serve in your terminal.
  4. Enjoy.

Please check out the kramdown manual for more information about how to pimp your tables: http://kramdown.gettalong.org/quickref.html#tables

Phlow
  • 688
  • 4
  • 14
  • 1
    This does not work. kramdown renders all elements outside of a table. But HTML lists inside a markdown table are not rendered. – udondan Nov 17 '17 at 15:29
  • That answer do not have a relationship to the question "multiline / lists inside a table" – KargWare Apr 15 '20 at 07:06