chirimen-oh / chirimen.org

Tutorials for CHIRIMEN
https://tutorial.chirimen.org/
Mozilla Public License 2.0
3 stars 7 forks source link

URL 自動リンク #13

Closed dynamis closed 5 years ago

dynamis commented 5 years ago

github 上で md ファイルを参照するときには自動リンクが付くが jekyll のビルドによる github pages では付かない。そのままでも良いけど自動リンクあった方が便利かも知れない。

取りあえず出来ないことを明確にするために issue を残します。

dynamis commented 5 years ago

GFM として処理させるようにした #24 ので解決したはず。

dynamis commented 5 years ago

kramdown の GFM に設定しても autolink が有効にならない様子。

https://jekyllrb.com/docs/configuration/markdown/

Jekyll デフォルトの redcarpet では autolink を有効にすれば良いが、GitHub Pages で採用する kramdown の設定にはない。

https://kramdown.gettalong.org/options.html

GitHub の Autolink では出来ると書いてあるが kramdown の issues では出来ないと書いている状況

https://help.github.com/articles/autolinked-references-and-urls/ https://github.com/gettalong/kramdown/issues/306

Did a little digging, and it looks like the autolink filter in HTML pipeline, uses Rinku, a Ruby gem which implements autolinking. It'd be an additional dependency, so its your call, but maybe make it an optional dependency that autolinks if present?

https://help.github.com/articles/updating-your-markdown-processor-to-kramdown/

2016 年には kramdown だけサポートすると宣言して現在のドキュメントでもそう書かれてるけど変わったのか、GFM 再現したければ html-pipilen の Rinku での処理と組み合わせろということのどちらかということかな。。。と探していたら 2017 年に SFM の仕様を固めたアナウンスをしていて実装もあった。

https://githubengineering.com/a-formal-spec-for-github-markdown/ https://github.com/github/cmark-gfm

cmark-gfm がリファレンス実装と考えれば良さそうだが、これを jekyll でどう使うかというのが問題。

dynamis commented 5 years ago

少しローカルで試行錯誤したのだけど、Gemfile 更新して

gem "github-pages", group: :jekyll_plugins

だけを書くようにしてあげると最新の github-pages が読み込まれ、そこから最新の jekyll-commonmark-ghpages が読み込まれるようになり、めでたく autolink オプションが有効になった。