<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Eyes-free Linux Ninja! (kramdown)</title><link>http://eyesfreelinux.ninja/</link><description></description><atom:link href="http://eyesfreelinux.ninja/categories/kramdown.xml" type="application/rss+xml" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 22 Sep 2017 20:57:19 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>How to Generate a Table of Contents in a Kramdown Document</title><link>http://eyesfreelinux.ninja/posts/how-to-generate-a-table-of-contents-in-a-kramdown-document.html</link><dc:creator>Mike</dc:creator><description>&lt;div&gt;&lt;p&gt;Here's how to generate a table of contents in &lt;code&gt;kramdown&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;

# Heading
{:.no_toc} 

## Table of Contents
{:.no_toc}

* TOC 
{:toc} 

&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;kramdown gem&lt;/code&gt; converts a kramdown file into html. It generates the id tags for each heading and 
uses them to generate a table of contents for a document. This becomes obvious if you take a file 
written in kramdown and convert it to html.&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;kramdown input-file.md &amp;gt; output-file.html
&lt;/pre&gt;


&lt;p&gt;The ids are put on the generated html for all headings.&lt;/p&gt;
&lt;h3&gt;How To Automatically Generate A Table of Contents&lt;/h3&gt;
&lt;p&gt;Typically, you will want to have a numbered list for your table of contents or a bulleted list of 
entries. This is done by either writing &lt;code&gt;1. TOC&lt;/code&gt; or &lt;code&gt;* TOC&lt;/code&gt; at the place in your file where you want 
the table of contents to be located. Underneath this line, specify the
table of contents itself:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;

{:toc}

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can have either a numbered list of items or a bulleted list, in
the normal way for lists:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;

1. TOC 
{:toc} 

* TOC 
{:toc} 

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you do not want a heading to be included in the table of 
contents, put:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;

`{:.no_toc}

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Underneath the entry you want to exclude from the table of contents, often your top-level heading.&lt;/p&gt;
&lt;h3&gt;Notes&lt;/h3&gt;
&lt;p&gt;I have noticed that there is either a bug or an accidental omission in the 
generation of the toc. For example,, given headings like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;

# First level one heading
## First level two heading 
## Second level two heading 
## Third level two heading
# Second level one heading

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I would expect the second level one heading to be a member of the list of level one headings, but it 
is left hanging in between two lists of second level headings, and is a member of no list. This bug 
makes sub-lists and then a return to a lower level further down impossible.&lt;/p&gt;
&lt;p&gt;So you will need to have all headings which go to make up a table of
contents the same level.&lt;/p&gt;
&lt;p&gt;A bit annoying but it beats constantly scrolling up and down a
document as you write it to try to remember the order of the headings
and their names.&lt;/p&gt;&lt;/div&gt;</description><category>kramdown</category><category>markdown</category><guid>http://eyesfreelinux.ninja/posts/how-to-generate-a-table-of-contents-in-a-kramdown-document.html</guid><pubDate>Sat, 01 Apr 2017 20:15:59 GMT</pubDate></item><item><title>Nikola plugin for kramdown</title><link>http://eyesfreelinux.ninja/posts/kramdown-plugin.html</link><dc:creator>Mike</dc:creator><description>&lt;div&gt;&lt;!--
.. title: Nikola plugin for kramdown
.. slug: kramdown-plugin
.. date: 2016-02-04 17:44:49 UTC
.. tags: kramdown, markdown
.. category: 
.. link: 
.. description: A Nikola plugin for kramdown posts and pages
.. type: text
--&gt;

&lt;p&gt;I’m not surprised that &lt;a href="http://daringfireball.net/"&gt;markdown&lt;/a&gt; has become so successful and ubiquitous.  But one of the 
things I think it lacks is syntax for creating tables.&lt;/p&gt;

&lt;p&gt;For this reason, I have been using a &lt;a href="http://txt2tags.org/"&gt;txt2tags&lt;/a&gt; plugin for a while.  My sites all have a 
lot of tabular data, both as a function of the nature of the sites and also because I just like 
tables.&lt;/p&gt;

&lt;p&gt;But I recently discovered &lt;a href="http://kramdown.gettalong.org/"&gt;kramdown&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;kramdown has a super-set of markdown syntax, including simple, but powerful table-creation syntax.&lt;/p&gt;

&lt;p&gt;So I’ve written a &lt;a href="https://plugins.getnikola.com/"&gt;plugin&lt;/a&gt; for &lt;a href="http://getnikola.com/"&gt;Nikola&lt;/a&gt; along the lines of the txt2tags plugin to 
compile HTML posts and pages from kramdown files.  For which I have started using the .kd extension.&lt;/p&gt;

&lt;p&gt;This post is written in kramdown.&lt;/p&gt;

&lt;p&gt;So this post is somewhat by way of a test of my kramdown plugin for Nikola.&lt;/p&gt;

&lt;h3&gt;Third-level Heading&lt;/h3&gt;

&lt;p&gt;The above heading is marked with two hash characters and in the same way that markdown posts have 
their heading demoted by one level I have done the same with kramdown.&lt;/p&gt;

&lt;p&gt;Here is a table of silly data:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style="text-align: right"&gt;Date&lt;/th&gt;
      &lt;th style="text-align: left"&gt;Weather&lt;/th&gt;
      &lt;th style="text-align: left"&gt;Activity&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style="text-align: right"&gt;01-Feb-2016&lt;/td&gt;
      &lt;td style="text-align: left"&gt;Rain&lt;/td&gt;
      &lt;td style="text-align: left"&gt;Stayed in&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style="text-align: right"&gt;02-Feb-2016&lt;/td&gt;
      &lt;td style="text-align: left"&gt;Dry and cloudy&lt;/td&gt;
      &lt;td style="text-align: left"&gt;Stayed in again&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style="text-align: right"&gt;03-Feb-2016&lt;/td&gt;
      &lt;td style="text-align: left"&gt;Cold, -4C&lt;/td&gt;
      &lt;td style="text-align: left"&gt;Had to go out for most of the day&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style="text-align: right"&gt;04-Feb-2016&lt;/td&gt;
      &lt;td style="text-align: left"&gt;Even colder than yesterday&lt;/td&gt;
      &lt;td style="text-align: left"&gt;Stayed in and wrote a kramdown plugin for Nikola&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3&gt;Lists&lt;/h3&gt;

&lt;p&gt;Lists are the same as in markdown&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;unordered list item one&lt;/li&gt;
  &lt;li&gt;Unordered list item two&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Links&lt;/h3&gt;

&lt;p&gt;The links in the above text are all done like references are done in markdown, with the actual URI 
of each link at the bottom of the text file.&lt;/p&gt;&lt;/div&gt;</description><category>kramdown</category><category>markdown</category><guid>http://eyesfreelinux.ninja/posts/kramdown-plugin.html</guid><pubDate>Thu, 04 Feb 2016 17:44:49 GMT</pubDate></item></channel></rss>