body core styles
This commit is contained in:
parent
77e4ecb2fb
commit
b1d2f7140b
1
cli.js
1
cli.js
|
@ -70,7 +70,6 @@ const cli = yargs(process.argv.slice(2))
|
|||
const CSS_VARS = CSS.rootVariables(CSS.FULL);
|
||||
Object.keys(CSS_VARS).map((key) => {
|
||||
cli.option(key, { default: CSS_VARS[key] });
|
||||
cli.conflicts(key, "body");
|
||||
return key;
|
||||
});
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@ mobile-friendly fashion!
|
|||
# OPTIONS
|
||||
|
||||
*--body*
|
||||
Generate only the HTML for the lines of the Gemini document.
|
||||
Generate only the HTML for the lines of the Gemini document. Use *--css* none
|
||||
to turn off the core inline styles.
|
||||
|
||||
*--html* _LANG_
|
||||
Generate a full HTML5 document with the provided _LANG_. *--dir* can be used
|
||||
|
|
19
html.js
19
html.js
|
@ -57,24 +57,27 @@ export function head(options) {
|
|||
|
||||
function line(
|
||||
{ text, href, title, pre, alt, h1, h2, h3, li, quote },
|
||||
{ image, audio, video, css } = {}
|
||||
{ image, audio, video, css, body } = {}
|
||||
) {
|
||||
if (text) return `<p>${escape(text)}</p>`;
|
||||
|
||||
const matchesExt = (url, exts) =>
|
||||
exts.some((ext) => new RegExp(`\.${ext}$`).test(url));
|
||||
if (href) {
|
||||
const titleProp = title ? ` title="${title}"` : "";
|
||||
const FIX_NORMAL_FLOW = body && css ? ` style="display: block; max-width: 100%;"` : ""
|
||||
const matchesExt = (url, exts) =>
|
||||
exts.some((ext) => new RegExp(`\.${ext}$`).test(url));
|
||||
|
||||
if (image && matchesExt(href, image)) {
|
||||
return `<img src="${href}"${titleProp}/>`;
|
||||
return `<img src="${href}"${titleProp}${FIX_NORMAL_FLOW}/>`;
|
||||
}
|
||||
if (audio && matchesExt(href, audio)) {
|
||||
return `<audio controls src="${href}"${titleProp}></audio>`;
|
||||
return `<audio controls src="${href}"${titleProp}${FIX_NORMAL_FLOW}></audio>`;
|
||||
}
|
||||
if (video && matchesExt(href, video)) {
|
||||
return `<video controls src="${href}"${titleProp}${FIX_NORMAL_FLOW}/></video>`;
|
||||
}
|
||||
if (video && matchesExt(href, video))
|
||||
return `<video controls src="${href}"${titleProp}/></video>`;
|
||||
|
||||
return `<a href="${href}">${title ? escape(title) : href}</a>`;
|
||||
return `<a href="${href}"${FIX_NORMAL_FLOW}>${title ? escape(title) : href}</a>`;
|
||||
}
|
||||
|
||||
if (h1) return `<h1>${escape(h1)}</h1>`;
|
||||
|
|
Loading…
Reference in a new issue