Jekyll markdown strikethrough
Asked Answered
I

2

15

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.

Intrados answered 8/6, 2013 at 21:37 Comment(0)
I
21

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.

Illyria answered 8/6, 2013 at 22:26 Comment(5)
Looks like I have a more general problem. #17005086Intrados
+1 for the jekyll --watch note. That was tripping me up.Deuteron
The jekyll --watch was key, especially since I had a separate watcher instance running in a different terminal and that was overwriting my output.Cabalist
“Note: Starting May 1st, 2016, GitHub Pages will only support kramdown.” help.github.com/articles/…Telpherage
Seems like Jekyll drops support for redcarpet and is kramdown only: jekyllrb.com/news/2019/08/20/jekyll-4-0-0-releasedLjubljana
A
4

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();
})();
Argillite answered 4/2, 2016 at 12:8 Comment(3)
" If you are currently using Rdiscount or Redcarpet we've enabled kramdown's GitHub-flavored Markdown support by default, meaning kramdown should have all the features of the two deprecated Markdown engines"Intrados
@Intrados Is there a config option I need to add to get ~~strikethough~~ working with kramdown on github-pages as it didn't work for me (after changing from redcarpet with strikethough extension)?Argillite
I don't know, I just quoted the page you linked.Intrados

© 2022 - 2024 — McMap. All rights reserved.