AK
Size: a a a
AK
nn
AK
nn
nn
nn
nn
F
nn
DE
const html = messages.getHtml(
unindent(source.trim()),
themeSlug,
lang !== 'auto' && lang
)
const page = await browser.newPage()
await page.evaluate((markup) => {
document.write(markup)
}, html)
const code = await page.$('#code')
const buffer = await code.screenshot()
await page.close()
return buffer
S
const html = messages.getHtml(
unindent(source.trim()),
themeSlug,
lang !== 'auto' && lang
)
const page = await browser.newPage()
await page.evaluate((markup) => {
document.write(markup)
}, html)
const code = await page.$('#code')
const buffer = await code.screenshot()
await page.close()
return buffer
DE
nn
AK
nn
nn
DE
const unindent = (text) => {
const lines = text.split('\n')
const counts = lines.slice(1)
.filter(Boolean)
.map((line) => line.match(/^\s*/)[0].length)
const min = Math.min(...counts)
const re = new RegExp(`\\s{${min}}`)
return lines.map((line) => line.replace(re, '')).join('\n')
}
S
const unindent = (text) => {
const lines = text.split('\n')
const counts = lines.slice(1)
.filter(Boolean)
.map((line) => line.match(/^\s*/)[0].length)
const min = Math.min(...counts)
const re = new RegExp(`\\s{${min}}`)
return lines.map((line) => line.replace(re, '')).join('\n')
}
AK