diff --git a/cli.js b/cli.js
index 9abfe0b..40631f0 100755
--- a/cli.js
+++ b/cli.js
@@ -9,7 +9,7 @@ import toHTML, { BASE_CSS, html } from "./html.js";
const cli = yargs(process.argv.slice(2))
.config("config", function (path) {
- return JSON.parse(readFileSync(path))
+ return JSON.parse(readFileSync(path));
})
.scriptName("gmi-web")
.command("$0 [files..]", "Convert text/gemini to text/html.", (yargs) =>
@@ -30,15 +30,23 @@ const cli = yargs(process.argv.slice(2))
type: "string",
requiresArg: true,
},
- charset: {
+ author: {
type: "string",
- default: "utf-8",
requiresArg: true,
},
+ descriptions: {
+ type: "boolean",
+ },
css: {
choices: ["gmi.css", "base", "none"],
default: "gmi.css",
},
+ charset: {
+ type: "string",
+ hidden: true,
+ default: "utf-8",
+ requiresArg: true,
+ },
});
cli.options({
@@ -85,10 +93,13 @@ const GMI_CSS_VARS = [
});
const argv = cli
+ .conflicts("author", "body")
+ .conflicts("description", "body")
.conflicts("html", "body")
- .group(["html", "css", "body"], "Core:")
- .group(GMI_CSS_VARS, "gmi.css:")
+ .group(["html", "body"], "Core:")
+ .group(["author", "description", "css"], "HTML:")
.group(["image", "audio", "video"], "Inline Media:")
+ .group(GMI_CSS_VARS, "gmi.css:")
.alias("html", "language")
.alias("html", "lang")
.showHelpOnFail(true)
@@ -100,7 +111,7 @@ if (argv.css === "gmi.css") {
if (argv[key]) {
style += `--${key}: ${argv[key]};`;
}
- return style
+ return style;
}, styles);
argv.css = new CleanCSS().minify(
diff --git a/gmi-web.1 b/gmi-web.1
index c65e5ad..0e7cd7e 100644
--- a/gmi-web.1
+++ b/gmi-web.1
@@ -31,6 +31,18 @@ Generate a full HTML5 document with the provided \fILANG\fR.
\fBgmi-web\fR --html en < doc.gmi
.P
.RE
+\fB--descriptions\fR
+.RS 4
+If this flag is set the first non-empty text line of each Gemini file will
+be used for the description tag. This will be truncated to 200
+characters using an ellipsis.
+.P
+.RE
+\fB--author\fR
+.RS 4
+If provided this will be used for the author tag on every file.
+.P
+.RE
\fB--body\fR
.RS 4
Generate only the HTML for the lines of the Gemini document.
diff --git a/gmi-web.1.scd b/gmi-web.1.scd
index 65d3dcd..43bf99f 100644
--- a/gmi-web.1.scd
+++ b/gmi-web.1.scd
@@ -22,6 +22,14 @@ and mobile-friendly fashion!
*gmi-web* --html en < doc.gmi
+*--descriptions*
+ If this flag is set the first non-empty text line of each Gemini file will
+ be used for the description tag. This will be truncated to 200
+ characters using an ellipsis.
+
+*--author*
+ If provided this will be used for the author tag on every file.
+
*--body*
Generate only the HTML for the lines of the Gemini document.
diff --git a/html.js b/html.js
index 451fac4..484a38a 100644
--- a/html.js
+++ b/html.js
@@ -2,12 +2,20 @@ import escape from "escape-html";
export const GMI_REGEX = /^((=>\s?(?[^\s]+)(\s(?.+))?)|(?