UNPKG

798 BJavaScriptView Raw
1import n from"node-fetch";import{marked as t}from"marked";function e(){return e=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},e.apply(this,arguments)}const r=/^(-{3}(?:\n|\r)([\w\W]+?)(?:\n|\r)-{3})?([\w\W]*)*/;function o(n){if(n.headers.get("Content-Type").includes("text"))return n.text()}function u(n){if(!n)return null;const{2:o,3:u}=r.exec(n),c=u?t(u):null,i=o?function(n){return n.split("\n").reduce((n,t)=>{const[r,o]=t.trim().split(": ",2);return e({},n,{[r]:o.slice(1,-1)})},{})}(o):null;return{head:i,content:c}}function c(t){return t?n(t).then(o).then(u).catch(()=>null):null}export{c as default};
2//# sourceMappingURL=markdown-service.modern.mjs.map