/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/metalsmith-metallic@2.0.3/lib/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var debug=require("debug")("metalsmith-metallic"),extname=require("path").extname,hljs=require("highlight.js"),entities=require("entities");function markdown(e){return/\.md|\.markdown/.test(extname(e))}function plugin(e){"use strict";return hljs.configure(e),function(e,t,n){setImmediate(n),Object.keys(e).forEach((function(t){if(debug("checking file: %s",t),markdown(t)){for(var n=e[t].contents.toString(),i=/^(\s*)```(.*)/m,s=n,r=0,h=0,u=[];i.test(s);){var l=i.exec(s),c=l[2]&&l[2].trim(),g=(c&&c.length)>0?c:null,o=r,a=l[0].length,d=l[1]?l[1].length:0;r=r+l.index+a,s=n.substring(r);var p=i.exec(s);if(null===p)break;h=p.index,u.push(n.substring(o,r-a+d));var m=r+h+((p[1]?p[1].length:0)+3);s=n.substring(m);var f=n.substring(r,r+h);if(f=f.trim("(\r\n|\n)"),r=m,null===g)u.push('<pre><code class="hljs">'+hljs.highlightAuto(f).value+"</code></pre>");else try{"no-highlight"===g?u.push('<pre><code class="hljs '+g+'">'+entities.encodeHTML(f)+"</code></pre>"):u.push('<pre><code class="hljs '+g+'">'+hljs.highlight(g,f).value+"</code></pre>")}catch(e){u.push("<pre><code>"+hljs.highlightAuto(f).value+"</code></pre>")}}r<n.length-1&&u.push(n.substring(r)),e[t].contents=new Buffer(u.join("")),debug(e[t].contents.toString())}}))}}module.exports=plugin;
//# sourceMappingURL=/sm/fcc3d2dcbc6c0c46b50edaea3e357b0d1d8765e8e9e0cfa847a151358784490d.map