Bug(?): `<html>` looks like not accepting attributes like `lang`?
Closed this issue · 0 comments
MaikoTan commented
Summary
Bonjour, I am the author of the FFXIV plugin koishi-plugin-ffxiv-macrodict
, which provides a convenient way to read the description of the ffxiv's game macros (text commands).
Recently I tried to switch the render function from page.SetContent()
and page.screenshot()
to use the <html>
message element provided by puppeteer
plugin. But now it looks like the font-family
-es CSS that I set for various languages are not functional, which makes the resulting character weird, especially in CJK (Chinese, Japanese and Korean characters).
So I guess that is because the html
message not accepting the lang
attributes?
Code
Here's how I utilize the puppeteer plugin for the image generation.
<html lang=lang>
<head>
<style>{css`
/* ... */
[lang="zh"] body {
font-family: 'Microsoft Yahei UI', SimHei, Consolas, 'Courier New', monospace;
}
[lang="ja"] body {
font-family: 'Yu Gothic', 'Yu Gothic UI', 'Meiryo UI', 'Meiryo', 'MS Gothic', Consolas, 'Courier New', monospace;
}
[lang="ko"] body {
font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', 'Nanum Gothic', Consolas, 'Courier New', monospace;
}
`}
</head>
{ /* ... */ }
</html>