猫でもわかるWebプログラミングと副業

本業エンジニアリングマネージャー。副業Webエンジニア。Web開発のヒントや、副業、日常生活のことを書きます。

GitHubから 'redcarpet' Markdown engine, which is no longer supported by GitHub Pages と言われた時の対処

jekillというツールを使うことで、githubにマークダウンをpushすると、自動でコンパイルされてhtmlを生成し、GitHub pages を公開してくれる仕組みがある。

先日久々にGitHub Pagesを更新しようとMarkdownをpushしたら以下のようなWarningがメールで届いた。

The page build completed successfully, but returned the following warning for the master branch:

You are currently using the 'redcarpet' Markdown engine, which is no longer supported by GitHub Pages and may cease working at any time. To ensure your site continues to build, remove the 'markdown' setting in your site's '_config.yml' file and confirm your site renders as expected. For more information, see https://help.github.com/articles/updating-your-markdown-processor-to-kramdown/.

簡単に日本語に直すとこうだ

ビルドは成功しましたが以下の問題点があります。あなたはMarkdownコンパイルredcarpet っていうやつを使っているけど、これはそのうちGitHub Pagesではサポートされなくなります。_config.yml から markdown の設定項目を消してね。詳しくは https://help.github.com/articles/updating-your-markdown-processor-to-kramdown/ を見てね

というころらしい。めっちゃ親切なエラーメッセージだ。リンク先の手順の通りにする。 _config.ymlmarkdown の設定を redcaroet から kramdown というのに帰ればいいらしいです。ついでに highlighter ってのも設定してみましたがここでは詳しく説明しません。

diff --git a/_config.yml b/_config.yml
index 3694ad5..c3494b2 100644
--- a/_config.yml
+++ b/_config.yml
@@ -1,3 +1,2 @@
-markdown: redcarpet
-redcarpet:
-  extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "strikethrough", "superscript"]
+markdown: kramdown
+highlighter: rouge

これでpushしたらいい感じにレンダリングされるようになった。

kramdownで検索したところ、コードブロックの書き方が違うとかの記事も見つけましたが、普通に ``` で書くことができました。