pages-gem icon indicating copy to clipboard operation
pages-gem copied to clipboard

Support for plugin adding anchors?

Open gjtorikian opened this issue 6 years ago • 7 comments

Hello @benbalter and @parkr! 👋

I was wondering if this project/GitHub would whitelist a simple text plugin that added anchor tags to headings, to allow for linking. Right now, there are only the following options:

  1. Use Kramdown, which supports this natively
    • Con: GitHub uses Commonmark, so there may be some rendering differences
  2. Incorporate https://github.com/allejo/jekyll-anchor-headings
    • Con: Liquid rendering can be a slow process, and for a site with many pages, this adds overhead.
    • Con: you must copy-paste a file into your site, preventing the ability for easy updates
  3. Use a JavaScript solution like anchor.js
    • Con: adds unnecessary client-side dependencies

I don't think the plugin I am proposing exists yet, so I'd be happy to write one if it'd be considered for inclusion. Thanks!

gjtorikian avatar Nov 16 '19 13:11 gjtorikian

Hi! I think we’ve shipped jekyll-commonmark support. Are you able to use that in your site to achieve anchors? markdown: jekyll-commonmark in your _config.yml if I remember correctly.

parkr avatar Nov 16 '19 15:11 parkr

Oh! I didn't know you supported that. Even better~

gjtorikian avatar Nov 16 '19 17:11 gjtorikian

Thanks!

gjtorikian avatar Nov 16 '19 17:11 gjtorikian

Oh, @parkr, I meant adding a information to h tags, not autolinking text URLs.

gjtorikian avatar Nov 16 '19 18:11 gjtorikian

If GitHub dot com does it, I don't see why we can't add it to jekyll-commonmark or jekyll-commonmark-ghpages!

parkr avatar Nov 18 '19 15:11 parkr

Looking at the gems, I see how this is immediately possible in jekyll-commonmark-ghpages. What's the difference between the two gems, though? Is -ghpages specifically catered to just a GH Pages environment?

gjtorikian avatar Nov 18 '19 17:11 gjtorikian

This works for me when I use markdown: CommonMarkGhPages in _config.yml.

nickserv avatar Jul 21 '20 10:07 nickserv