gist.pug – Github gists mixins

View source code on Github

Embed gists

mixin gist(user, id)
  - if (id.length != 32)
    - throw new Error("Invalid gist id length. Must be 32 but is " + id.length)
  script(src=`https://gist.github.com/${user}/${id}.js`)&attributes(attributes)
+gist(user, id)

Embed a gist passing their user and identificator. You can obtain these parameters from the gist page url.

Arguments:
  • user (string) – Gist owner username.
  • id (string) – Gist identificator

Usage

Input

gist("mondeja", "2bd82917552ff2589ddffc4a92744825")

Output

<script src="https://gist.github.com/mondeja/2bd82917552ff2589ddffc4a92744825.js"></script>

Render