@notion-md-converter/core
Version:
Notion to Markdown Converter
2 lines (1 loc) • 22.6 kB
JavaScript
import{isFullBlock as t}from"@notionhq/client";const e=t=>Object.entries(t).map((([t,e])=>null==e?null:"boolean"==typeof e?e?t:null:`${t}="${e}"`)).filter((t=>!!t)).join(" "),r={objectToPropertiesStr:e,objectTag:t=>`<object ${e({data:t.data,type:t.type,width:t.width??"100%",height:t.height??"250"})}></object>`,videoTag:t=>`<video ${e({src:t.src,controls:t.controls??!0,width:t.width,height:t.height})}></video>`},n={default:void 0,default_background:void 0,red:"#A83232",red_background:"#E8CCCC",orange:"#C17F46",orange_background:"#E8D5C2",yellow:"#9B8D27",yellow_background:"#E6E6C8",brown:"#8B6C55",brown_background:"#E0D5CC",green:"#4E7548",green_background:"#D5E0D1",blue:"#3A6B9F",blue_background:"#D0DEF0",purple:"#6B5B95",purple_background:"#D8D3E6",pink:"#B5787D",pink_background:"#E8D5D8",gray:"#777777",gray_background:"#D0D0D0"},o=["red_background","orange_background","yellow_background","green_background","blue_background","purple_background","pink_background","gray_background","brown_background"],c=["red","orange","yellow","green","blue","purple","pink","gray","brown"],i=(t,e)=>{if(!t||!t.trim())return t;const r=t.match(/^(\s*)(.+?)(\s*)$/);if(!r)return t;const[,n,o,c]=r,{decoration:i}=e;return`${n}${i}${o}${i}${c}`},a={heading:(t,e)=>`${"#".repeat(e)} ${t}`,bold:t=>i(t,{decoration:"**"}),italic:t=>i(t,{decoration:"*"}),strikethrough:t=>i(t,{decoration:"~~"}),inlineCode:t=>`\`${t}\``,underline:t=>`_${t}_`,color:(t,e,i=n)=>{if(!t||!t.trim())return t;const a={},l=i[e];if(!l)return t;if(o.includes(e)?a.style=`background-color: ${l};`:c.includes(e)&&(a.style=`color: ${l};`),Object.keys(a).length>0){return`<span ${r.objectToPropertiesStr(a)}>${t}</span>`}return t},bulletList:(t,e="-")=>`${e} ${t}`,numberedList:(t,e)=>`${e}. ${t}`,checkList:(t,e)=>`- [${e?"x":" "}] ${t}`,link:(t,e)=>`[${t}](${e})`,image:(t,e,r={})=>{const{width:n}=r;let o=e;return n&&(o+=` =${n}x`),``},codeBlock:(t,e)=>`\`\`\`${e||""}\n${t}\n\`\`\``,blockEquation:t=>`$$\n${t}\n$$`,inlineEquation:t=>`$${t}$`,blockquote:t=>t.split("\n").map((t=>`> ${t}`)).join("\n"),table:(t,e)=>{const r=t.map(((t,r)=>{const n=[t.content,...e.map((t=>t[r].content))],o=Math.max(...n.map((t=>t.length)));return o<3?3:o})),n=`| ${t.map(((t,e)=>t.content.padEnd(r[e]))).join(" | ")} |`,o=`| ${t.map(((t,e)=>{const n=r[e];switch(t.alignment){case"left":return`:${"-".repeat(n-1)}`;case"center":return`:${"-".repeat(n-2)}:`;case"right":return`${"-".repeat(n-1)}:`;default:return"-".repeat(n)}})).join(" | ")} |`;if(0===e.length)return`${n}\n${o}`;return`${n}\n${o}\n${e.map((t=>`| ${t.map(((t,e)=>t.content.padEnd(r[e]))).join(" | ")} |`)).join("\n")}`},horizontalRule:(t="hyphen")=>{switch(t){case"hyphen":return"---";case"asterisk":return"***";case"underscore":return"___"}},wrapWithNewLines:t=>`\n${t}\n`,indent:(t,e=2)=>t.split("\n").map((t=>""===t?t:`${" ".repeat(e)}${t}`)).join("\n"),details:(t,e)=>["<details>","<summary>",t,"</summary>","",e,"</details>"].join("\n"),comment:t=>`\x3c!-- ${t} --\x3e`,decoration:i,COLOR_MAP:n},l=["bookmark","breadcrumb","bulleted_list_item","callout","code","column_list","column","divider","equation","file","heading_1","heading_2","heading_3","image","link_preview","pdf","quote","synced_block","numbered_list_item","table","table_of_contents","to_do","toggle","video","paragraph","embed","child_database","child_page"],s=t=>"block"===t.object&&l.includes(t.type),u=t=>"file"===t.type,d=t=>"external"===t.type,h=t=>"bookmark"===t.type,p=t=>"breadcrumb"===t.type,m=t=>"bulleted_list_item"===t.type&&Array.isArray(t.children),b=t=>"callout"===t.type&&Array.isArray(t.children),k=t=>"code"===t.type,f=t=>"column_list"===t.type&&Array.isArray(t.children),g=t=>"column"===t.type&&Array.isArray(t.children),x=t=>"divider"===t.type,y=t=>"equation"===t.type,_=t=>"file"===t.type,w=t=>"heading_1"===t.type,$=t=>"heading_2"===t.type,B=t=>"heading_3"===t.type,T=t=>"image"===t.type,v=t=>"link_preview"===t.type,j=t=>"numbered_list_item"===t.type&&Array.isArray(t.children),A=t=>"paragraph"===t.type&&Array.isArray(t.children),E=t=>"pdf"===t.type,L=t=>"quote"===t.type,M=t=>"synced_block"===t.type&&Array.isArray(t.children),q=t=>"table"===t.type&&Array.isArray(t.children),F=t=>"table_row"===t.type,R=t=>"table_of_contents"===t.type,C=t=>"to_do"===t.type&&Array.isArray(t.children),D=t=>"toggle"===t.type&&Array.isArray(t.children),P=t=>"video"===t.type,W=t=>"embed"===t.type,N=t=>new Promise((e=>setTimeout(e,t))),U=async(t,e=3,r=1e3)=>{for(let n=0;n<e;n++)try{return await t()}catch(t){if(n===e-1||!t||"object"!=typeof t||!("code"in t)||"rate_limited"!==t.code)throw t;const o=r*2**n;await N(o)}throw new Error("Max retries reached")};class z{constructor(t){this.waiting=[],this.permits=t}async acquire(){if(!(this.permits>0))return new Promise((t=>{this.waiting.push(t)}));this.permits--}release(){this.permits++;const t=this.waiting.shift();t&&(this.permits--,t())}async withLock(t){await this.acquire();try{return await t()}finally{this.release()}}}const I=async(e,r,n)=>{const o=n||new z(3),c=[];let i;for(;;){const t=await o.withLock((()=>U((()=>e.blocks.children.list({block_id:r,start_cursor:i})))));if(c.push(...t.results),!t.has_more)break;i=t.next_cursor??void 0}for(const e of c)if(!t(e))throw new Error("Block is not full");const a=c.map((async(t,r)=>{if(t.has_children){return{index:r,children:await I(e,t.id,o)}}return{index:r,children:[]}})),l=await Promise.all(a);for(const t of l)c[t.index].children=t.children;return c},S=async(t,e)=>{const r=[];let n;for(;;){const o=await U((()=>t.databases.query({database_id:e,start_cursor:n})));if(r.push(...o.results),n=o.next_cursor??void 0,!n)break}return r};function O(t){if(t.includes("notion.so")){const e=t.match(/([a-f0-9]{32}|[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/);if(!e)throw new Error("Invalid Notion page URL format");return e[1].replace(/-/g,"")}const e=t.replace(/-/g,"");if(!/^[a-f0-9]{32}$/i.test(e))throw new Error("Invalid page ID format");return e}const V=t=>{try{return new URL(t),!0}catch(t){return!1}};class G{constructor(t,e){this.metadata=t,this.text=e}static fromRichText(t){const e=t.map((t=>t.plain_text)).join(""),r=e.split(":");if(1===r.length)return new G({},t);const n=r[0].split("&").reduce(((t,e)=>{const[r,n]=e.split("=");return t[r]=n||void 0,t}),{}),o=r.slice(1).join(":"),c=e.indexOf(o);if(""===o)return new G(n,[]);let i=0;const a=t.reduce(((t,e)=>{const r=e.plain_text,n=i;if(i+=r.length,n>=c)t.push(e);else if(n+r.length>c){const o=c-n;"text"===e.type&&t.push({...e,plain_text:r.slice(o),text:{...e.text,content:e.text.content.slice(o)}})}return t}),[]);return new G(n,a)}getMetadata(){return{...this.metadata}}getText(){return[...this.text]}getMetadataValue(t){return this.metadata[t]}hasMetadata(t){return t in this.metadata}}const H=t=>{const e=new URL(t),r=e.hostname,n=e.pathname;return["x.com","twitter.com"].includes(r)?"x":["codesandbox.io"].includes(r)?"codesandbox":["codepen.io"].includes(r)?"codepen":["github.com"].includes(r)?"github":["gist.github.com"].includes(r)?"github-gist":["asciinema.org"].includes(r)?"asciinema":["www.figma.com","figma.com"].includes(r)?"figma":["speakerdeck.com"].includes(r)?"speaker-deck":["www.slideshare.net","slideshare.net"].includes(r)?"slideshare":["docs.google.com"].includes(r)&&n.startsWith("/presentation/d/")?"google-slide":["www.docswell.com","docswell.com"].includes(r)?"docswell":["www.youtube.com","youtube.com"].includes(r)?"youtube":["jsfiddle.net"].includes(r)?"jsfiddle":["codesandbox.io"].includes(r)?"codesandbox":["stackblitz.com"].includes(r)?"stackblitz":["blueprintue.com"].includes(r)?"blueprintue":null},J=t=>{const e=new URL(t);return new URLSearchParams(e.search).get("v")},K={getVideoIdFromUrl:J,embed:(t,e={})=>{const n=J(t);if(!n)return null;const o={width:e.width||"560",height:e.height||"315",src:`https://www.youtube.com/embed/${n}`,frameborder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",loading:"lazy",allowfullscreen:!0};return`<iframe ${r.objectToPropertiesStr(o)}></iframe>`}},Q={embed:(t,e={})=>{const n=new URL(t).pathname.split("/"),o=n[3],c=n[1],i={"data-height":e.height||"250","data-theme-id":"0","data-slug-hash":o,"data-default-tab":e.defaultTab||"result","data-user":c,"data-embed-version":"2","data-pen-title":o,class:"codepen"};return`${`<p ${r.objectToPropertiesStr(i)}></p>`}\n<script async src="https://production-assets.codepen.io/assets/embed/ei.js"><\/script>`}},X={embed:t=>{if(!t.endsWith(".js"))return null;const e=new URL(t).pathname.split("/")[1].replace(".js","");return`<script ${r.objectToPropertiesStr({id:`asciicast-${e}`,src:t,async:!0})}><\/script>`}},Y={getType:H,embedByUrl:(t,e=G.fromRichText([]),r={})=>{const n=r.supportedEmbedProviders||{youtube:!0,codepen:!0,asciinema:!0},o=H(t);if(!o||!["youtube","codepen","asciinema"].includes(o))return null;if(!n[o])return null;switch(o){case"youtube":return K.embed(t,e.getMetadata());case"codepen":return Q.embed(t,e.getMetadata());case"asciinema":return X.embed(t);default:return null}}},Z=t=>e=>u(e)?t({type:e.type,url:e.file.url,expiryTime:e.file.expiry_time}):t({type:e.type,url:e.external.url}),tt=()=>Z((({url:t})=>({url:t})));class et{constructor(t={}){this.colorMap=t.colorMap||a.COLOR_MAP,this.enableAnnotations=t.enableAnnotations||{bold:!0,italic:!0,strikethrough:!0,underline:!0,code:!0,equation:!0,color:!1,link:!0}}format(t,e){const r=(t,e)=>{let r=t.plain_text;return t.annotations.code&&e.code&&(r=a.inlineCode(r)),"equation"===t.type&&e.equation&&(r=a.inlineEquation(r)),t.annotations.bold&&e.bold&&(r=a.bold(r)),t.annotations.italic&&e.italic&&(r=a.italic(r)),t.annotations.strikethrough&&e.strikethrough&&(r=a.strikethrough(r)),t.annotations.underline&&e.underline&&(r=a.underline(r)),t.annotations.color&&e.color&&(r=a.color(r,t.annotations.color,this.colorMap)),t.href&&V(t.href)&&e.link&&(r=a.link(r,t.href)),r},n={...this.enableAnnotations,...e};return t.map((t=>r(t,n))).join("").trim()}plainText(t){return t.map((t=>t.plain_text)).join("")}}class rt extends Error{constructor(t){super(`Unsupported block type: ${t.type}`)}}const nt=t=>e=>{if(""===e.currentBlock.bookmark.url)return null;const r=G.fromRichText(e.currentBlock.bookmark.caption);return t({block:e.currentBlock,captionMetadata:r,context:e})},ot=t=>e=>t({block:e.currentBlock,context:e}),ct=t=>e=>{const r=e.execute(e.currentBlock.children);return t({block:e.currentBlock,children:r,context:e})},it=t=>e=>{const r=G.fromRichText(e.currentBlock.code.caption);return t({block:e.currentBlock,captionMetadata:r,context:e})},at=t=>e=>{const r=e.currentBlock.children.map((t=>e.execute(t.children)));return t({block:e.currentBlock,columns:r,context:e})},lt=t=>e=>t({block:e.currentBlock,context:e}),st=t=>e=>t({block:e.currentBlock,context:e}),ut=t=>e=>{const r=G.fromRichText(e.currentBlock.file.caption);return t({block:e.currentBlock,captionMetadata:r,context:e})},dt=t=>e=>{switch(e.currentBlock.type){case"heading_1":return t({block:e.currentBlock,level:1,richText:e.currentBlock.heading_1.rich_text,isToggleable:!1,color:e.currentBlock.heading_1.color,context:e});case"heading_2":return t({block:e.currentBlock,level:2,richText:e.currentBlock.heading_2.rich_text,isToggleable:!1,color:e.currentBlock.heading_2.color,context:e});case"heading_3":return t({block:e.currentBlock,level:3,richText:e.currentBlock.heading_3.rich_text,isToggleable:!1,color:e.currentBlock.heading_3.color,context:e});default:throw new rt(e.currentBlock)}},ht=t=>e=>{const r=e.currentBlock.image;if(!("external"===r.type?r.external.url:r.file.url))return null;const n=G.fromRichText(e.currentBlock.image.caption);return t({block:e.currentBlock,captionMetadata:n,context:e})},pt=t=>e=>t({block:e.currentBlock,context:e}),mt=t=>e=>{const r=e.execute(e.currentBlock.children);return t({block:e.currentBlock,children:r,context:e})},bt=t=>e=>{const r=e.blocks.slice(0,e.currentBlockIndex);let n=1;for(let t=r.length-1;t>=0&&j(r[t]);t--)n++;const o=e.execute(e.currentBlock.children);return t({block:e.currentBlock,children:o,index:n,context:e})},kt=t=>e=>{const r=e.execute(e.currentBlock.children);return t({block:e.currentBlock,children:r,context:e})},ft=t=>e=>{const r=e.execute(e.currentBlock.children);return t({block:e.currentBlock,children:r,context:e})},gt=t=>e=>{const r=G.fromRichText(e.currentBlock.pdf.caption);return t({block:e.currentBlock,captionMetadata:r,context:e})},xt=t=>e=>{const r=e.execute(e.currentBlock.children);return t({block:e.currentBlock,children:r,context:e})},yt=t=>e=>{const r=e.execute(e.currentBlock.children),n=null===e.currentBlock.synced_block.synced_from;return t({block:e.currentBlock,isSynchronizationSource:n,children:r,context:e})},_t=t=>e=>t({block:e.currentBlock,context:e}),wt=t=>e=>{const r=e.currentBlock,n=r.children[0],o=r.children.slice(1);return t({block:e.currentBlock,header:n,rows:o,context:e})},$t=t=>e=>{const r=e.execute(e.currentBlock.children);return t({block:e.currentBlock,children:r,context:e})},Bt=t=>e=>{const r=e.currentBlock.video;if(!("external"===r.type?r.external.url:r.file.url))return null;const n=G.fromRichText(e.currentBlock.video.caption);return t({block:e.currentBlock,captionMetadata:n,context:e})},Tt=t=>e=>{const r=G.fromRichText(e.currentBlock.embed.caption);return t({block:e.currentBlock,captionMetadata:r,context:e})},vt=t=>e=>t({block:e.currentBlock,context:e}),jt=t=>e=>t({block:e.currentBlock,context:e}),At=()=>nt((({block:t,captionMetadata:e,context:r})=>{const n=e.getText(),o=r.tools.richTextFormatter.format(n);return a.link(o||t.bookmark.url,t.bookmark.url)})),Et=()=>ot((()=>null)),Lt=()=>mt((({block:t,children:e,context:r})=>{const n=r.tools.richTextFormatter.format(t.bulleted_list_item.rich_text),o=a.indent(e),c=a.bulletList(n);return""===e?c:`${c}\n${o}`})),Mt=()=>ct((({block:t,children:e,context:r})=>{let n=r.tools.richTextFormatter.format(t.callout.rich_text);return""!==e&&(n+=`\n${e}`),a.wrapWithNewLines(a.blockquote(n))})),qt=(t={})=>{const{languageMapping:e}=t;return it((({block:t,context:r})=>{const n=r.tools.richTextFormatter.plainText(t.code.rich_text),o=e?e[t.code.language]:t.code.language;return a.wrapWithNewLines(a.codeBlock(n,o?.replace(" ","_")))}))},Ft=()=>at((({columns:t})=>t.join("\n"))),Rt=()=>lt((()=>a.wrapWithNewLines(a.horizontalRule()))),Ct=({type:t="equation"}={})=>st((({block:e})=>{const r=e.equation.expression;return a.wrapWithNewLines("code"===t?a.codeBlock(r,"txt"):a.blockEquation(r))})),Dt=(t={})=>ut((({block:e,context:r})=>{const n=t.fileAdapter??tt(),{url:o}=n(e.file),c=e.file.caption.length>0?r.tools.richTextFormatter.format(e.file.caption):e.file.name;return a.link(c,o)})),Pt=()=>dt((({level:t,richText:e,context:r})=>{const n=r.tools.richTextFormatter.format(e);return a.wrapWithNewLines(a.heading(n,t))})),Wt=(t={})=>ht((({block:e,context:r})=>{const n=t.fileAdapter??tt(),{url:o}=n(e.image),c=e.image.caption.length>0?r.tools.richTextFormatter.format(e.image.caption):o;return a.image(c??o,o)})),Nt=()=>pt((({block:t})=>{const e=t.link_preview.url;return a.link(e,e)})),Ut=()=>bt((({block:t,children:e,index:r,context:n})=>{const o=n.tools.richTextFormatter.format(t.numbered_list_item.rich_text),c=a.indent(e,3),i=a.numberedList(o,r);return""===e?i:`${i}\n${c}`})),zt=(t={})=>{const{br:e=!1}=t;return ft((({block:t,children:r,context:n})=>{const o=n.tools.richTextFormatter.format(t.paragraph.rich_text),c=""!==r?`${o}\n${r}`:o;return e?`${c}<br />`:c}))},It=(t={outputType:"markdown-link"})=>gt((({block:e,captionMetadata:n,context:o})=>{const c=t.fileAdapter??tt(),{url:i}=c(e.pdf);if("markdown-link"===t.outputType){return`[${e.pdf.caption.length>0?o.tools.richTextFormatter.format(e.pdf.caption):i}](${i})`}if("html-object"===t.outputType)return r.objectTag({data:i,type:"application/pdf",...n.getMetadata()});throw new Error(`Invalid output type: ${t.outputType}`)})),St=()=>xt((({block:t,children:e,context:r})=>{let n=r.tools.richTextFormatter.format(t.quote.rich_text);return""!==e&&(n+=`\n${e}`),a.wrapWithNewLines(a.blockquote(n))})),Ot=()=>yt((({children:t})=>t)),Vt=()=>_t((()=>null)),Gt=()=>wt((({header:t,rows:e,context:r})=>{const n=t.table_row.cells.map((t=>({content:r.tools.richTextFormatter.format(t)}))),o=e.map((t=>t.table_row.cells.map((t=>({content:r.tools.richTextFormatter.format(t)})))));return a.wrapWithNewLines(a.table(n,o))})),Ht=()=>kt((({block:t,children:e,context:r})=>{const n=r.tools.richTextFormatter.format(t.to_do.rich_text),o=a.indent(e),c=a.checkList(n,t.to_do.checked);return""===e?c:`${c}\n${o}`})),Jt=()=>$t((({block:t,children:e,context:r})=>{const n=r.tools.richTextFormatter.format(t.toggle.rich_text);return a.wrapWithNewLines(a.details(n,e))})),Kt=(t={})=>Bt((({block:e,captionMetadata:n})=>{const o=t.fileAdapter??tt(),{url:c}=o(e.video);return a.wrapWithNewLines(r.videoTag({src:c,...n.getMetadata()}))})),Qt=(t={})=>{const{enableEmbed:e=!0,supportedEmbedProviders:r}=t;return Tt((({block:t,captionMetadata:n,context:o})=>{if(e&&r){const e=Y.embedByUrl(t.embed.url,n,{supportedEmbedProviders:r});if(e)return e}const c=o.tools.richTextFormatter.format(n.getText()),i=t.embed.url;return a.link(c||i,i)}))},Xt=({log:t}={log:!1})=>t=>null;class Yt extends Error{constructor(t){super(`Block is not a root block: ${t.type}`)}}class Zt{constructor(t={}){this.tools={richTextFormatter:new et,...t.tools||{}},this.transformers=this.initializeTransformers(t.transformers||{})}initializeTransformers(t){return{bookmark:At(),breadcrumb:Et(),bulleted_list_item:Lt(),callout:Mt(),code:qt(),column_list:Ft(),divider:Rt(),equation:Ct(),heading:Pt(),link_preview:Nt(),numbered_list_item:Ut(),paragraph:zt(),quote:St(),synced_block:Ot(),table_of_contents:Vt(),table:Gt(),to_do:Ht(),toggle:Jt(),file:Dt(),image:Wt(),pdf:It(),video:Kt(),embed:Qt(),...t}}execute(t){const e=this.transformBlocks(t);return this.onComplete(e)}transformBlocks(t){const e={execute:t=>this.transformBlocks(t),blocks:t,currentBlock:t[0],currentBlockIndex:0,tools:this.tools};return t.map(((t,r)=>{if(e.currentBlock=t,e.currentBlockIndex=r,h(t)){const t=e;return this.transformers.bookmark?.(t)??""}if(p(t)){const t=e;return this.transformers.breadcrumb?.(t)??""}if(b(t)){const t=e;return this.transformers.callout?.(t)??""}if(k(t)){const t=e;return this.transformers.code?.(t)??""}if(f(t)){const t=e;return this.transformers.column_list?.(t)??""}if(x(t)){const t=e;return this.transformers.divider?.(t)??""}if(y(t)){const t=e;return this.transformers.equation?.(t)??""}if(w(t)){const t=e;return this.transformers.heading?.(t)??""}if($(t)){const t=e;return this.transformers.heading?.(t)??""}if(B(t)){const t=e;return this.transformers.heading?.(t)??""}if(v(t)){const t=e;return this.transformers.link_preview?.(t)??""}if(m(t)){const t=e;return this.transformers.bulleted_list_item?.(t)??""}if(j(t)){const t=e;return this.transformers.numbered_list_item?.(t)??""}if(C(t)){const t=e;return this.transformers.to_do?.(t)??""}if(A(t)){const t=e;return this.transformers.paragraph?.(t)??""}if(L(t)){const t=e;return this.transformers.quote?.(t)??""}if(M(t)){const t=e;return this.transformers.synced_block?.(t)??""}if(R(t)){const t=e;return this.transformers.table_of_contents?.(t)??""}if(q(t)){const t=e;return this.transformers.table?.(t)??""}if(D(t)){const t=e;return this.transformers.toggle?.(t)??""}if(W(t)){const t=e;return this.transformers.embed?.(t)??""}if(T(t)){const t=e;return this.transformers.image?.(t)??""}if(P(t)){const t=e;return this.transformers.video?.(t)??""}if(E(t)){const t=e;return this.transformers.pdf?.(t)??""}})).filter((t=>null!=t)).join("\n")}onComplete(t){return t}}export{S as $getDatabasePages,I as $getPageFullContent,et as BasicRichTextFormatter,G as CaptionMetadata,r as HTMLUtils,a as MarkdownUtils,Yt as NotRootBlockError,Zt as NotionMarkdownConverter,X as ProviderAsciinemaUtils,Q as ProviderCodePenUtils,Y as ProviderUtils,K as ProviderYoutubeUtils,rt as UnsupportedBlockError,nt as createBookmarkTransformerFactory,ot as createBreadcrumbTransformerFactory,mt as createBulletedListItemTransformerFactory,ct as createCalloutTransformerFactory,vt as createChildDatabaseTransformerFactory,jt as createChildPageTransformerFactory,it as createCodeTransformerFactory,at as createColumnListTransformerFactory,lt as createDividerTransformerFactory,Tt as createEmbedTransformerFactory,st as createEquationTransformerFactory,Z as createFileAdapter,ut as createFileTransformerFactory,dt as createHeadingTransformerFactory,ht as createImageTransformerFactory,pt as createLinkPreviewTransformerFactory,At as createMarkdownBookmarkTransformer,Et as createMarkdownBreadcrumbTransformer,Lt as createMarkdownBulletedListItemTransformer,Mt as createMarkdownCalloutTransformer,qt as createMarkdownCodeTransformer,Ft as createMarkdownColumnListTransformer,Rt as createMarkdownDividerTransformer,Qt as createMarkdownEmbedTransformer,Ct as createMarkdownEquationTransformer,Dt as createMarkdownFileTransformer,Pt as createMarkdownHeadingTransformer,Wt as createMarkdownImageTransformer,Nt as createMarkdownLinkPreviewTransformer,Ut as createMarkdownNumberedListItemTransformer,It as createMarkdownPDFTransformer,zt as createMarkdownParagraphTransformer,St as createMarkdownQuoteTransformer,Ot as createMarkdownSyncedBlockTransformer,Vt as createMarkdownTableOfContentsTransformer,Gt as createMarkdownTableTransformer,Ht as createMarkdownTodoListItemTransformer,Jt as createMarkdownToggleTransformer,Kt as createMarkdownVideoTransformer,tt as createNoChangeFileObjectAdapter,bt as createNumberedListItemTransformerFactory,gt as createPDFTransformerFactory,ft as createParagraphTransformerFactory,xt as createQuoteTransformerFactory,yt as createSyncedBlockTransformerFactory,_t as createTableOfContentsTransformerFactory,wt as createTableTransformerFactory,kt as createTodoTransformerFactory,$t as createToggleTransformerFactory,Xt as createUnsupportedBlockTransformer,Bt as createVideoTransformerFactory,N as delay,O as extractPageId,h as isBookmarkBlock,p as isBreadcrumbBlock,m as isBulletedListItemBlock,b as isCalloutBlock,k as isCodeBlock,g as isColumnBlock,f as isColumnListBlock,x as isDividerBlock,W as isEmbedBlock,y as isEquationBlock,_ as isFileBlock,w as isHeading1Block,$ as isHeading2Block,B as isHeading3Block,T as isImageBlock,v as isLinkPreviewBlock,d as isNotionExternalFile,u as isNotionInternalFile,j as isNumberedListItemBlock,A as isParagraphBlock,E as isPdfBlock,L as isQuoteBlock,s as isRootBlock,M as isSyncedBlock,q as isTableBlock,R as isTableOfContentsBlock,F as isTableRowBlock,C as isToDoBlock,D as isToggleBlock,V as isURL,P as isVideoBlock,U as retryWithBackoff};