UNPKG

561 BJavaScriptView Raw
1import n from"node-fetch";import{marked as t}from"marked";const e=/^(-{3}(?:\n|\r)([\w\W]+?)(?:\n|\r)-{3})?([\w\W]*)*/;function r(n){if(n.headers.get("Content-Type").includes("text"))return n.text()}function u(n){if(!n)return null;const{2:r,3:u}=e.exec(n),c=u?t(u):null,l=r?function(n){return n.split("\n").reduce((n,t)=>{const[e,r]=t.trim().split(": ",2);return{...n,[e]:r.slice(1,-1)}},{})}(r):null;return{head:l,content:c}}function c(t){return t?n(t).then(r).then(u).catch(()=>null):null}export{c as default};
2//# sourceMappingURL=markdown-service.es.js.map