Add Comic Sans easter egg
This commit is contained in:
parent
3cb301360e
commit
7d6cf5b09f
7 changed files with 55 additions and 18 deletions
27
lib/fonts.js
27
lib/fonts.js
|
@ -110,3 +110,30 @@ export const DMSans = [
|
|||
style: 'normal'
|
||||
}
|
||||
]
|
||||
|
||||
export const ComicSans = [
|
||||
{
|
||||
name: 'Comic Sans MS',
|
||||
data: fs.readFileSync('./assets/ComicSans/ComicSans-Regular.ttf'),
|
||||
weight: 400,
|
||||
style: 'normal'
|
||||
},
|
||||
{
|
||||
name: 'Comic Sans MS',
|
||||
data: fs.readFileSync('./assets/ComicSans/ComicSans-Italic.ttf'),
|
||||
weight: 400,
|
||||
style: 'italic'
|
||||
},
|
||||
{
|
||||
name: 'Comic Sans MS',
|
||||
data: fs.readFileSync('./assets/ComicSans/ComicSans-Bold.ttf'),
|
||||
weight: 700,
|
||||
style: 'normal'
|
||||
},
|
||||
{
|
||||
name: 'Comic Sans MS',
|
||||
data: fs.readFileSync('./assets/ComicSans/ComicSans-BoldItalic.ttf'),
|
||||
weight: 700,
|
||||
style: 'italic'
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
import html2png, { renderHtml as htmlParser } from '@besties/html2png'
|
||||
import fs from 'node:fs'
|
||||
import { DMSans } from './fonts.js'
|
||||
|
||||
const css = fs.readFileSync('./assets/style.css', 'utf8')
|
||||
|
||||
const renderOptions = {
|
||||
fonts: DMSans
|
||||
}
|
||||
|
||||
export default async function (html, options = {}) {
|
||||
return html2png(html, css, { ...renderOptions, ...options })
|
||||
return html2png(html, css, options)
|
||||
}
|
||||
|
||||
export async function renderHtml(html) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue