fix parse config bug
move charset to top of head
This commit is contained in:
parent
6a11b71497
commit
45e90e61ac
5
cli.js
5
cli.js
|
@ -8,6 +8,9 @@ import CleanCSS from "clean-css";
|
|||
import toHTML, { BASE_CSS, html } from "./html.js";
|
||||
|
||||
const cli = yargs(process.argv.slice(2))
|
||||
.config("config", function (path) {
|
||||
return JSON.parse(readFileSync(path))
|
||||
})
|
||||
.scriptName("gmi-web")
|
||||
.command("$0 [files..]", "Convert text/gemini to text/html.", (yargs) =>
|
||||
yargs
|
||||
|
@ -88,7 +91,6 @@ const argv = cli
|
|||
.group(["image", "audio", "video"], "Inline Media:")
|
||||
.alias("html", "language")
|
||||
.alias("html", "lang")
|
||||
.config()
|
||||
.showHelpOnFail(true)
|
||||
.help().argv;
|
||||
|
||||
|
@ -98,6 +100,7 @@ if (argv.css === "gmi.css") {
|
|||
if (argv[key]) {
|
||||
style += `--${key}: ${argv[key]};`;
|
||||
}
|
||||
return style
|
||||
}, styles);
|
||||
|
||||
argv.css = new CleanCSS().minify(
|
||||
|
|
5
html.js
5
html.js
|
@ -29,11 +29,10 @@ export const BASE_CSS =
|
|||
"p,a,pre,h1,h2,h3,ul,blockquote,img,audio,video{display:block;max-width:100%;margin:0;padding:0;overflow-wrap:anywhere;}";
|
||||
export function head(options) {
|
||||
return `
|
||||
<meta charset="${options.charset}">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
${options.css !== "" ? `<meta name="color-scheme" content="dark light">` : ""}
|
||||
${options.css !== "" ? `<style>${options.css}</style>` : ""}
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta charset="${options.charset}">
|
||||
<meta language="${options.language}">
|
||||
<title>${options.title}</title>${
|
||||
!options.description
|
||||
? ""
|
||||
|
|
Loading…
Reference in a new issue