From 57361c9c06ed7405f2d03a503947621cbd998f43 Mon Sep 17 00:00:00 2001 From: Gael Girodon Date: Tue, 29 Aug 2023 19:45:37 +0200 Subject: [PATCH] Improve code and documentation --- README.md | 5 ++--- src/util.js | 2 +- test/hooks.js | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d728e24..9197b05 100644 --- a/README.md +++ b/README.md @@ -103,9 +103,8 @@ The `--layout` option can receive the name of a [preset](./assets/layouts/) A theme is a CSS stylesheet included in the HTML layout. -The `--theme` option can receive the name of a [preset](./assets/themes/) (e.g. -`github`) or the path to a custom theme file (`path/to/my-theme.css` or an HTTP -URL). +The `--theme` option can receive the name of a preset (e.g. `github`) +or the path to a custom theme file (`path/to/my-theme.css` or an HTTP URL). #### Highlight style (`--highlight-style`) diff --git a/src/util.js b/src/util.js index 94dadcc..57e05bc 100644 --- a/src/util.js +++ b/src/util.js @@ -8,7 +8,7 @@ export function randomId() { /** * Get the text content of the first element matching the given tag - * using a naive regex-base search which is very limited, but avoids + * using a naive regex-based search which is very limited, but avoids * importing a full HTML parser library only to do that. * @param {string} html The HTML document * @param {string} tag The HTML tag name diff --git a/test/hooks.js b/test/hooks.js index 4f8550d..5c019a5 100644 --- a/test/hooks.js +++ b/test/hooks.js @@ -22,8 +22,8 @@ before(async () => { }); await fs.mkdir(buildDataPath("img"), { recursive: true }); for (let url of Object.keys(images)) { - const data = (await request(url)).body; - await fs.writeFile(buildDataPath(images[url]), data); + const res = await request(url); + await fs.writeFile(buildDataPath(images[url]), res.body); } await fs.writeFile(buildDataPath("README.md"), output, { encoding: "utf8" }); });