--- 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`を追加する(Source Code) 5. `_config.yml`の`markdown: rdiscount`を以下のように修正する
1
2
3
4
5
6
7
8
9
<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>
## Pygment.rbの不具合 Snow Leopardだとなぜかこの問題に悩まされたため、この対応を実施しました: > @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`の以下の行をコメントアウトしました:
1
2
3
4
5
<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>
## 参考URL * Octopress で GitHub Flavored Markdown (GFM) を使う * Using Octopress With Github Flavored Markdown (RedCarpet) * Github flavored Markdown and pygments highlighting in Jekyll * MentosError header errors * Liquid Exception: Failed to get header. in 2013-06-04-welcome-to-jekyll.markdown