/jekyll-plugins

Short custom plugins for Jekyll that don't deserve their own repositories. [Not maintained].

Primary LanguageRubyOtherNOASSERTION

Custom plugins for the Jekyll static site generator.

css_mathches.rb

css_mathches.rb returns a value indicating whether the css selector matches any elements.

It depends upon nokogiri: $ [sudo] gem install nokogiri.

For example with {% assign x = content | css_matches: "li:not(:empty)" %}, x will be true if content contains a non-empty <li> tag.

xpath_mathches.rb

xpath_mathches.rb is a counterpart to css_mathches.rb returns a value indicating whether the xpath selector matches any elements.

It depends upon nokogiri: $ [sudo] gem install nokogiri.

For example with {% assign x = content | xpath_matches: "a[@href='help.php']" %}, x will be true if content contains an anchor tag, <a>, with a href attribute of value help.php.

filehash.rb

filehash.rb generates a SHA1 hex digest for a given file.

It has no dependencies.

h1kramdown.rb

h1kramdown.rb patches Kramdown::Converter::Html.convert_header so that it inserts an empty a element as the first child of h[1..6] elements, with href pointing to the id of the h[1..6] element. It can be styled with the selector h[1..6] > a:first-child:empty.

It depends on kramdown: $ [sudo] gem install kramdown.

It will produce HTML markup such as the following: <h4 id="social-media"><a href="#social-media"></a>Social Media</h4>.

handleize.rb

handleize.rb is a liquid filter that forms a valid handle/slug from an input string. On https://tomthorogood.co.uk/ it is used to create a class token: <body class="{{ page.path | handleize }}"> -> <body class="pages-home-md">.

It has no dependencies.

handleize.rb has been removed in favour of the builtin slugify filter.

linguist.rb

linguist.rb contains the tag linguist_colors that outputs css rules corresponding to languages that linguist (used by GitHub) detects.

It depends on linguist: $ [sudo] gem install github-linguist.

It accepts a property to assign the colour to and a css selector that replaces the {language} token with a slug derived from the language name.

math.rb

math.rb provides liquid filters to access the following Math module methods: acos acosh asin asinh atan atan2 atanh cbrt cos cosh erf erfc exp frexp gamma hypot ldexp lgamma log log10 log2 sin sinh sqrt tan tanh. It also provides filters to access the following Numeric module methods: abs abs2 divmod remainder.

It has no dependencies.

mathml.rb

mathml.rb converts TeX into MathML. It provides a liquid tag math (and closing tag endmath), TeX within the tag will be converted into MathML. If kramdown is installed it will also replace Kramdown::Converter::Html.convert_math so that MathML can be generated using kramdown builtins. To clarify you can always use {% math %}...{% endmath %} but when using the kramdown parser you can also use $$...$$.

It depends on either MathJax-node, itextomml or ritex.

mathml.rb has been removed in favor of kramdown's Ritex support, itex2MML support and Mathjax-Node support.

needs_highlighter.rb

needs_highlighter.rb returns a value indicating whether any code tags with class attribute that contain language- exist in the input string.

It depends upon nokogiri: $ [sudo] gem install nokogiri.

needs_highlighter.rb has been removed in favour of css_mathches.rb. It can be replicated with: css_matches: "code[class*=language-]:not(.nohighlight)".

urn.rb

urn.rb adds Uniform Resource Names in the urn:uuid format to site, posts and pages. It creates a v5 UUID with NameSpace_DNS if it can recover a domain name from the base URL, falling back to a NameSpace_URL of the base URL if it cannot. Posts and pages have v5 UUIDs with NameSpace_URL created from their full URL. If it is present the base URL will be set to url, uri or domain from _config.yml prefixing with http:// if no protocol is specified. Finally if none are present the base URL is set to file://#{site.source}.

It depends on ruby-uuid.rb.

ruby-uuid.rb

ruby-uuid.rb is a UUID library and is solely a dependency of urn.rb. It is Copyright(c) 2005 URABE, Shyouhei.

*[UUID]: universally unique identifier *[UUIDs]: universally unique identifiers