Skip to content

Instantly share code, notes, and snippets.

@cachrisman
Created March 23, 2018 07:32
Show Gist options
  • Save cachrisman/96db3cd7668ab3805a3560ad67fdb69f to your computer and use it in GitHub Desktop.
Save cachrisman/96db3cd7668ab3805a3560ad67fdb69f to your computer and use it in GitHub Desktop.
(function(extension) {
if (typeof showdown !== 'undefined') {
// global (browser or nodejs global)
extension(showdown);
} else if (typeof define === 'function' && define.amd) {
// AMD
define(['showdown'], extension);
} else if (typeof exports === 'object') {
// Node, CommonJS-like
module.exports = extension(require('showdown'));
} else {
// showdown was not found so we throw
throw Error('Could not find showdown library');
}
}(function(showdown) {
showdown.extension('callout', function() {
return [{
type: 'lang',
regex: '```callout-important(.*)```',
replace: '<div class="callout callout-important">$1</div>'
}]
})
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment