Skip to content

Instantly share code, notes, and snippets.

@ggrossetie
Created November 19, 2018 14:19
Show Gist options
  • Save ggrossetie/4b44db7b60724ceb3d969a449f30a48a to your computer and use it in GitHub Desktop.
Save ggrossetie/4b44db7b60724ceb3d969a449f30a48a to your computer and use it in GitHub Desktop.
Asciidoctor.js Gist extension
registry.blockMacro(function () {
const self = this;
self.named('gist')
self.process(function (parent, target, attrs) {
const titleHTML = attrs.title ? `<div class="title">${attrs.title}</div>\n` : ''
const html = `<div class="openblock gist">
${titleHTML}<div class="content">
<script src="https://gist.github.com/${target}.js"></script>
</div>
</div>`
return self.createBlock(parent, 'pass', html, attrs, {})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment