UNPKG

@mdast2docx/image

Version:

MDAST to DOCX plugin for resolving and embedding images. Supports base64, URLs, and custom resolvers for seamless DOCX image integration.

2 lines (1 loc) 480 B
var g=e=>{let t=new Uint8Array(e).slice(0,4);if(t[0]===66&&t[1]===77)return"bmp";switch(t.reduce((n,i)=>n+i.toString(16).padStart(2,"0"),"").toUpperCase()){case"89504E47":return"png";case"47494638":return"gif";case"FFD8FFE0":case"FFD8FFE1":case"FFD8FFE2":case"FFD8FFE3":case"FFD8FFE8":return"jpg"}},r=null,a=!1,s=async e=>(!r&&e.placeholder&&!a?(a=!0,r=await e.imageResolver(e.placeholder,e)):r={type:"gif",data:"",transformation:{width:200,height:200}},r);export{g as a,s as b};