Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll & KramDown - How to Display Table Border

I am using Jekyll default kramdown. I have a table showed using

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

But the table does not have border. How to show the border.

like image 638
vancexu Avatar asked Mar 02 '15 09:03

vancexu


People also ask

What is Jekyll used for?

Jekyll is a free and open source static site generator. Like a content management system (for example, Drupal and WordPress), Jekyll can be used to build websites with rich and easy-to-use navigation.

What is Jekyll code?

Jekyll is a popular site generator that transforms plain text documents (Markdown, HMTL, CSS, etc.) into static sites that can easily be used for blogs and informational websites.

Do people still use Jekyll?

Its growth has not been as fast as a few other, newer SSGs in recent years, but it remains a very popular choice. Jekyll was created to simplify website hosting and infrastructure management, mostly by getting rid of it. It replaced the need for a database with files that can be put under version control.

Who created Jekyll?

Tom Preston-Werner founded GitHub in 2008 with his cofounders Chris Wanstrath, P. J. Hyett, and Scott Chacon. 2008 was a busy year for Tom. Nine months after founding GitHub, in December 2008, he launched Jekyll — a simple, blog-aware, static site generator.


1 Answers

I was able to assign a style class to a markdown table this way. It gives a table with a black line border and border between the cells.

Markdown example: In file hello-world.md

| Item | Description | Price | | --- | --- | ---: | | item1 | item1 description | 1.00 | | item2 | item2 description | 100.00 | {:.mbtablestyle} 

SCSS in _base.scss file in /_sass/ directory

.mbtablestyle {         border-collapse: collapse;     > table, td, th {         border: 1px solid black;         } } 

This was in jekyll version 3.1.2 which uses Kramdown with an IAL. The IAL is inside { } and must be right before or right after the block it is assigned to in the markdown file, no blank lines between them.

like image 83
MikeBRal Avatar answered Oct 10 '22 01:10

MikeBRal