cause
This commit is contained in:
parent
f3b51cf3ae
commit
853752ec5c
21
html.js
21
html.js
|
@ -20,6 +20,17 @@ export function toHTML(gemtext, options) {
|
|||
const truncate = (text, limit) =>
|
||||
text.length > limit ? `${text.substring(0, limit)}...` : text;
|
||||
|
||||
function overrideStyles(options) {
|
||||
if (options.css !== "full") return "";
|
||||
const vars = CSS.rootVariables(CSS.FULL);
|
||||
|
||||
return Object.keys(vars).reduce((styles, key) => {
|
||||
if (options[key] && options[key] !== vars[key])
|
||||
styles += `--${key}: ${options[key]};`;
|
||||
return styles;
|
||||
}, "");
|
||||
}
|
||||
|
||||
return `<!DOCTYPE html>
|
||||
<html lang="${options.language}" dir="${options.dir}" style="${overrideStyles(
|
||||
options
|
||||
|
@ -38,16 +49,6 @@ ${body(tokens, options)}
|
|||
`;
|
||||
}
|
||||
|
||||
function overrideStyles(options) {
|
||||
if (options.css !== "full") return "";
|
||||
const vars = CSS.rootVariables(CSS.FULL)
|
||||
|
||||
return Object.keys(vars).reduce((styles, key) => {
|
||||
if (options[key] && options[key] !== vars[key]) styles += `--${key}: ${options[key]};`;
|
||||
return styles;
|
||||
}, "");
|
||||
}
|
||||
|
||||
export function head(options) {
|
||||
return `
|
||||
<meta charset="${options.charset}">
|
||||
|
|
Loading…
Reference in a new issue