This commit is contained in:
Talon Poole 2021-02-20 21:37:35 +00:00
parent 94abcfd542
commit 0e7b1f086e
3 changed files with 38 additions and 36 deletions

View file

@ -71,6 +71,36 @@ A command-line utility that pulls all of the above together into a unix-like API
npm install --global gmi-web-cli && gmi-web --help
```
## config
A JSON file can be passed to `--config` for conveniently applying any option without using the command-line flag. For example a `web.json` file with the following contents...
```json
{
"html": "en",
"descriptions": 200,
"foreground": "#137752",
"background": "#F4F4F4"
}
```
...can be used like so:
```sh
gmi-web --config web.json $(find ~/gmi/dst -name '*.gmi')
```
## custom css
It is possible to use your own set of completely custom CSS rules _and_ variables by pointing to a file containing them.
```sh
gmi-web --body --css custom.css < doc.gmi
```
gmi-web auto-detects the need for the `<meta>` color-schemes and allows for using `--inline` to insert the declarations as `style` properties on their respective blocks. Variables defined in `:root` will be picked up and made available for configuration just like gmi-web.css.
```
gmi-web [files..]
@ -122,6 +152,7 @@ CSS:
--ul-family [default: "var(--serif)"]
--ul-size [default: "var(--p-size)"]
--ul-height [default: "1.25"]
--ul-style [default: "circle"]
--quote-family [default: "var(--serif)"]
--quote-size [default: "var(--p-size)"]
--quote-height [default: "1.25"]
@ -141,35 +172,6 @@ Examples:
See the gmi-web(1) man page for more information.
```
## config
A JSON file can be passed to `--config` for conveniently applying any option without using the command-line flag. For example a `web.json` file with the following contents...
```json
{
"html": "en",
"descriptions": 200,
"foreground": "#137752",
"background": "#F4F4F4"
}
```
...can be used like so:
```sh
gmi-web --config web.json $(find ~/gmi/dst -name '*.gmi')
```
## custom css
It is possible to use your own set of completely custom CSS rules _and_ variables by pointing to a .css file containing them.
```sh
gmi-web --body --css custom.css < doc.gmi
```
gmi-web auto-detects the need for the `<meta>` color-schemes and allows for using `--inline` to insert the declarations as `style` properties on their respective blocks. Variables defined in `:root` will be picked up and made available for customization via command-line flags.
# license
gmi-web is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.

12
cli.js
View file

@ -82,13 +82,13 @@ const cli = yargs(process.argv.slice(2))
});
const CSS_VARS = CSS.rootVariables(CSS.load({ css: "gmi-web.css" }));
Object.keys(CSS_VARS).map((key) => {
cli.option(key, { default: CSS_VARS[key] });
cli.conflicts(key, "core");
cli.conflicts(key, "none");
return key;
Object.keys(CSS_VARS).forEach((key) => {
const opt = key.replace("--", "")
cli.option(opt, { default: CSS_VARS[key] });
cli.conflicts(opt, "core");
cli.conflicts(opt, "none");
});
cli.group(Object.keys(CSS_VARS), "CSS:");
cli.group(Object.keys(CSS_VARS).map(key => key.replace("--", "")), "CSS:");
const argv = cli
.conflicts("author", "body")

View file

@ -1,6 +1,6 @@
{
"name": "gmi-web-cli",
"version": "1.0.0-rc.3",
"version": "1.0.1-rc.3",
"description": "A bridge between HTML and Gemini",
"main": "html.js",
"type": "module",