2019-03-31 11:00:21 +00:00
---
title: Github Flavored Markdown を Octopress で使用する
author: kazu634
date: 2013-06-29
geo_latitude:
- 38.306229
geo_longitude:
- 141.022706
geo_public:
- 1
wordtwit_posted_tweets:
- 'a:1:{i:0;i:1823;}'
wordtwit_post_info:
- 'O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:1823;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}'
categories:
- インフラ
---
## Github Flavored Markdown
備忘録として記録しておきます:
1. `Gemfile` に`gem ' redcarpet' , ' ~> 2.1.1' `を追加する
2. `Gemfile` に`gem ' albino' , ' ~> 1.3.3' `を追加する
3. `bundle install`
4. `plugin` ディレクトリに`redcarpet2_markdown.rb`を追加する(< a href = "https://raw.github.com/nono/Jekyll-plugins/master/redcarpet2_markdown.rb" onclick = "__gaTracker('send', 'event', 'outbound-article', 'https://raw.github.com/nono/Jekyll-plugins/master/redcarpet2_markdown.rb', 'Source Code');" > Source Code</ a > )
5. `_config.yml` の`markdown: rdiscount`を以下のように修正する< figure class = 'code' > < figcaption >
< span > < / span > < / figcaption >
< div class = "highlight" >
< table >
< tr >
< td class = "gutter" >
< pre class = "line-numbers" > < span class = 'line-number' > 1< / span >
< span class = 'line-number' > 2< / span >
< span class = 'line-number' > 3< / span >
< span class = 'line-number' > 4< / span >
< span class = 'line-number' > 5< / span >
< span class = 'line-number' > 6< / span >
< span class = 'line-number' > 7< / span >
< span class = 'line-number' > 8< / span >
< span class = 'line-number' > 9< / span >
< / pre >
< / td >
< td class = 'code' >
< pre > < code class = 'diff' > < span class='line'>< span class="gd">-markdown: rdiscount< /span>
< /span>< span class='line'>< span class="gd">-rdiscount:< /span>
< /span>< span class='line'>< span class="gd">- extensions:< /span>
< /span>< span class='line'>< span class="gd">- - autolink< /span>
< /span>< span class='line'>< span class="gd">- - footnotes< /span>
< /span>< span class='line'>< span class="gd">- - smart< /span>
< /span>< span class='line'>< span class="gi">+markdown: redcarpet2< /span>
< /span>< span class='line'>< span class="gi">+redcarpet:< /span>
< /span>< span class='line'>< span class="gi">+ extentions: ["hard_wrap"]< /span>
< /span>< / code > < / pre >
< / td >
< / tr >
< / table >
< / div > < / figure >
## Pygment.rbの不具合
Snow Leopardだとなぜか< a href = "https://github.com/tmm1/pygments.rb/issues/45" onclick = "__gaTracker('send', 'event', 'outbound-article', 'https://github.com/tmm1/pygments.rb/issues/45', 'この問題');" > この問題< / a > に悩まされたため、この対応を実施しました:
> @mattwildig – thanks for posting your fix here. I was getting the same with Ruby 1.8, Pygments 0.5.0, and Python 2.6.1. Commenting out the relevant block in mentos.py fixed the issue for me (and now Jekyll works again – see mojombo/jekyll#1181).
具体的には`pygments.rb/lib/pygments/mentos.py`の< a href = "https://github.com/tmm1/pygments.rb/blob/f82642a314bfc80088eea6e81df44b11e8d2193a/lib/pygments/mentos.py#L339-L343" onclick = "__gaTracker('send', 'event', 'outbound-article', 'https://github.com/tmm1/pygments.rb/blob/f82642a314bfc80088eea6e81df44b11e8d2193a/lib/pygments/mentos.py#L339-L343', '以下の行');" > 以下の行< / a > をコメントアウトしました:< figure class = 'code' > < figcaption >
< span > < / span > < / figcaption >
< div class = "highlight" >
< table >
< tr >
< td class = "gutter" >
< pre class = "line-numbers" > < span class = 'line-number' > 1< / span >
< span class = 'line-number' > 2< / span >
< span class = 'line-number' > 3< / span >
< span class = 'line-number' > 4< / span >
< span class = 'line-number' > 5< / span >
< / pre >
< / td >
< td class = 'code' >
< pre > < code class = 'python' > < span class='line'>< span class="k">for< /span> < span class="n">fd< /span> < span class="ow">in< /span> < span class="nb">range< /span>< span class="p">(< /span>< span class="mi">3< /span>< span class="p">,< /span> < span class="n">maxfd< /span>< span class="p">):< /span>
< /span>< span class='line'> < span class="k">try< /span>< span class="p">:< /span>
< /span>< span class='line'> < span class="n">os< /span>< span class="o">.< /span>< span class="n">close< /span>< span class="p">(< /span>< span class="n">fd< /span>< span class="p">)< /span>
< /span>< span class='line'> < span class="k">except< /span>< span class="p">:< /span>
< /span>< span class='line'> < span class="k">pass< /span>
< /span>< / code > < / pre >
< / td >
< / tr >
< / table >
< / div > < / figure >
## 参考URL
* < a href = "http://tdksk.github.io/blog/2013/05/06/use-gfm-in-octopress/" onclick = "__gaTracker('send', 'event', 'outbound-article', 'http://tdksk.github.io/blog/2013/05/06/use-gfm-in-octopress/', 'Octopress で GitHub Flavored Markdown (GFM) を使う');" > Octopress で GitHub Flavored Markdown (GFM) を使う</ a >
* < a href = "http://yangsu.github.io/blog/2012/10/11/using-octopress-with-github-flavored-markdown-redcarpet/" onclick = "__gaTracker('send', 'event', 'outbound-article', 'http://yangsu.github.io/blog/2012/10/11/using-octopress-with-github-flavored-markdown-redcarpet/', 'Using Octopress With Github Flavored Markdown (RedCarpet)');" > Using Octopress With Github Flavored Markdown (RedCarpet)</ a >
* < a href = "http://stackoverflow.com/questions/13464590/github-flavored-markdown-and-pygments-highlighting-in-jekyll" onclick = "__gaTracker('send', 'event', 'outbound-article', 'http://stackoverflow.com/questions/13464590/github-flavored-markdown-and-pygments-highlighting-in-jekyll', 'Github flavored Markdown and pygments highlighting in Jekyll');" > Github flavored Markdown and pygments highlighting in Jekyll</ a >
* < a href = "https://github.com/tmm1/pygments.rb/issues/45" onclick = "__gaTracker('send', 'event', 'outbound-article', 'https://github.com/tmm1/pygments.rb/issues/45', 'MentosError header errors');" > MentosError header errors</ a >
2019-04-02 16:06:15 +00:00
* < a href = "https://github.com/mojombo/jekyll/issues/1181" onclick = "__gaTracker('send', 'event', 'outbound-article', 'https://github.com/mojombo/jekyll/issues/1181', 'Liquid Exception: Failed to get header. in 2013-06-04-welcome-to-jekyll.markdown');" > Liquid Exception: Failed to get header. in 2013-06-04-welcome-to-jekyll.markdown</ a >