PageSourceSearch

https://designcode.io/assets/markdownPdf-DN86cInm.js

js designcode.io collected 2026-09-24 17:16:29 UTC 2,943 bytes, 2 lines download raw bytes

1import{E as k}from"./jspdf.es.min-5UWZnwXi.js";import"./index-BFZ9jTwb.js";const a=52,S=56,L=52,P=(o="")=>String(o||"").replace(/\u00a0/g," ").replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').replace(/[\u2013\u2014]/g,"-").replace(/\u2026/g,"...").replace(/\u2022/g,"-").normalize("NFKD").replace(/[\u0300-\u036f]/g,"").split("").filter(s=>{const e=s.charCodeAt(0);return e===9||e===10||e===13||e>=32&&e<=126}).join(""),x=(o="")=>P(o).replace(/!\[([^\]]*)\]\(([^)]+)\)/g,"$1").replace(/\[([^\]]+)\]\(([^)]+)\)/g,(s,e,i)=>`${e} (${i})`).replace(/<([^>]+)>/g,"$1").replace(/(\*\*|__)(.*?)\1/g,"$2").replace(/(\*|_)(.*?)\1/g,"$2").replace(/~~(.*?)~~/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),T=({markdown:o="",title:s="Lesson notes"}={})=>{const e=new k({orientation:"portrait",unit:"pt",format:"a4",compress:!0}),i=e.internal.pageSize.getWidth(),p=e.internal.pageSize.getHeight(),w=i-a*2;let t=S,h=!1,m=[];e.setProperties({title:P(s),subject:"DesignCode lesson notes",creator:"DesignCode"});const z=(n=0)=>{t+n<=p-L||(e.addPage(),t=S)},f=(n,{size:$=10.5,lineHeight:r=15,style:d="normal",font:l="helvetica",indent:u=0,before:g=0,after:M=0,color:C=[39,39,42]}={})=>{const b=P(n).trim();if(!b)return;const D=e.splitTextToSize(b,Math.max(80,w-u));z(g+r),t+=g,e.setFont(l,d),e.setFontSize($),e.setTextColor(...C),D.forEach(F=>{z(r),e.text(F,a+u,t),t+=r}),t+=M},c=()=>{m.length&&(f(x(m.join(" ")),{after:5}),m=[])};String(o||"").replace(/\r/g,"").split(`
2`).forEach(n=>{const $=n.trimEnd(),r=$.trim();if(/^```/.test(r)){c(),h=!h,t+=h?5:8;return}if(h){f($||" ",{size:8.5,lineHeight:12,font:"courier",indent:10,color:[63,63,70]});return}if(!r){c(),t+=5;return}const d=r.match(/^(#{1,6})\s+(.+)$/);if(d){c();const g=d[1].length,M={1:{size:23,lineHeight:28,before:4,after:12},2:{size:17,lineHeight:22,before:14,after:8},3:{size:13.5,lineHeight:18,before:11,after:6}};f(x(d[2]),{...M[g]||{size:11.5,lineHeight:16,before:9,after:4},style:"bold",color:[24,24,27]});return}if(/^(?:-{3,}|\*{3,}|_{3,})$/.test(r)){c(),z(18),t+=8,e.setDrawColor(212,212,216),e.setLineWidth(.6),e.line(a,t,i-a,t),t+=10;return}const l=r.match(/^([-*+]|\d+[.)])\s+(.+)$/);if(l){c();const g=/^\d/.test(l[1])?l[1]:"-";f(`${g} ${x(l[2])}`,{indent:12,after:2});return}const u=r.match(/^>\s?(.*)$/);if(u){c(),f(x(u[1]),{style:"italic",indent:14,before:3,after:5,color:[82,82,91]});return}m.push(r)}),c();const _=e.getNumberOfPages();for(let n=1;n<=_;n+=1)e.setPage(n),e.setDrawColor(228,228,231),e.setLineWidth(.5),e.line(a,p-34,i-a,p-34),e.setFont("helvetica","normal"),e.setFontSize(8),e.setTextColor(113,113,122),e.text(P(s),a,p-20),e.text(`${n} / ${_}`,i-a,p-20,{align:"right"});return e},W=({markdown:o="",title:s="Lesson notes",fileName:e="lesson-notes.pdf"}={})=>{T({markdown:o,title:s}).save(e)},v=({markdown:o="",title:s="Lesson notes"}={})=>T({markdown:o,title:s}).output("blob");export{T as createMarkdownPdf,v as createMarkdownPdfBlob,W as downloadMarkdownPdf};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.