GithubHelp home page GithubHelp logo

tmthrgd / jekyll-plugins Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 26 KB

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

License: Other

Ruby 100.00%
jekyll plugin jekyll-plugin nokogiri xpath css-selector sha1 linguist math urn

jekyll-plugins's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.