Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll markdown strikethrough

I can't get Jekyll's markdown processor to listen to me. These all display as is:

1.  ~Call Mom today.~

1.  ~~Call Mom today.~~

This just makes the internal text disappear:

1.  <s> Call Mom today.</s>

I'm using Jekyll Bootstrap pretty much out of the box.

like image 437
djechlin Avatar asked Jun 08 '13 21:06

djechlin


People also ask

Does Jekyll support Markdown?

Jekyll supports Markdown in addition to HTML when building pages. Markdown is a great choice for pages with a simple content structure (just paragraphs, headings and images), as it's less verbose than raw HTML.

Does Jekyll use Kramdown?

Kramdown is the default Markdown renderer for Jekyll, and often works well with no additional configuration.


2 Answers

Perhaps this

markdown: redcarpet
redcarpet:
  extensions: ["strikethrough"]

Github flavored Markdown and pygments highlighting in Jekyll

Or

echo '1. <s>Call Mom today.</s>' | kramdown

Result

<ol>
  <li>
    <s>Call Mom today.</s>
  </li>
</ol>

Note if you are using jekyll --watch this config change will not be picked up; you will need to restart Jekyll.

like image 124
Zombo Avatar answered Oct 03 '22 15:10

Zombo


If you are using Jekyll with GitHub Pages then you will no longer be allowed to use redcarpet - kramdown will only be supported. So until kramdown supports "~~strikethough~~" with markdown I'm using a javascript to add strikethrough to page's text:

(function() {
  function strikethrough(){
    document.body.innerHTML = document.body.innerHTML.replace(
      /\~\~(.+?)\~\~/gim,
      '<del>$1</del>'
    );
  }
  strikethrough();
})();
like image 36
David Douglas Avatar answered Oct 03 '22 13:10

David Douglas