Skip to content

Commit 17a7d0e

Browse files
Upgrade
1 parent 347d76a commit 17a7d0e

File tree

8 files changed

+36
-24
lines changed

8 files changed

+36
-24
lines changed

bin/html.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#!/usr/bin/env node
22

3-
import fs, { createReadStream } from "node:fs";
3+
import fs, { createReadStream } from 'node:fs';
44

55
import concat from 'concat-stream';
6-
import envPaths from "env-paths";
7-
import { parse } from "yaml";
6+
import envPaths from 'env-paths';
7+
import { parse } from 'yaml';
88

99
import cliHtml from '../index.js';
1010

11-
const paths = envPaths("cli-html", {
12-
suffix: "",
11+
const paths = envPaths('cli-html', {
12+
suffix: '',
1313
});
14-
let fileContent = "";
14+
let fileContent = '';
1515
try {
16-
fileContent = fs.readFileSync(`${paths.config}/theme.yml`, "utf8");
16+
fileContent = fs.readFileSync(`${paths.config}/theme.yml`, 'utf8');
1717
} catch {}
1818

1919
const theme = parse(fileContent) || {};

examples/defs.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<dl>
2+
<dt>Coffee</dt>
3+
<dd>Black hot drink</dd>
4+
<dt>Milk</dt>
5+
<dd>White cold drink</dd>
6+
</dl>
7+

lib/tag-helpers/text-node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const textNode = (tag, context) => {
1212
};
1313
}
1414

15-
const normalized = [...normalizeWhitespace(tag.value).replaceAll('\n', ' ')];
15+
const normalized = [...(normalizeWhitespace(tag.value) || '').replaceAll('\n', ' ')];
1616

1717
const pre = [' ', '\n'].includes(normalized[0]) ? normalized.shift() : null;
1818
const post = [' ', '\n'].includes(normalized.at(-1)) ? normalized.pop() : null;

lib/tags/blockquote.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { indentify } from '../utils.js';
66

77
export const blockquote = (tag, context) => blockTag(
88
compose(
9-
(value, tag) => indentify(context.theme.blockquote('│ '))(value),
10-
(value, tag) => value,
9+
indentify(context.theme.blockquote('│ ')),
1110
),
1211
{ marginTop: 1, marginBottom: 1 },
1312
)(tag, { ...context, lineWidth: context.lineWidth - 2 });

lib/tags/definitions.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ import { blockTag } from '../tag-helpers/block-tag.js';
44
import { indentify } from '../utils.js';
55

66
export const dt = (tag, context) => blockTag(
7-
compose((value) => context.theme.dt(value)),
7+
context.theme.dt,
88
{ marginTop: 1, marginBottom: 1 },
99
)(tag, { ...context, lineWidth: context.lineWidth - 1 });
1010

11-
export const dd = (tag, context) => blockTag(indentify(' '), { marginTop: 1, marginBottom: 1 })(tag, {
11+
export const dd = (tag, context) => blockTag(compose(
12+
context.theme.dd,
13+
indentify(' '),
14+
), { marginTop: 1, marginBottom: 1 })(tag, {
1215
...context,
1316
lineWidth: context.lineWidth - 3,
1417
});

lib/tags/inputs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import inlineTag from '../tag-helpers/inline-tag.js';
44
import { getAttribute } from '../utils.js';
55

66
const {
7-
grey, red, bgBlack,
7+
grey, red, green, bgBlack,
88
} = chalk;
99

1010
export const button = inlineTag(
@@ -22,7 +22,7 @@ export const input = (tag) => {
2222
return {
2323
pre: null,
2424
value: `${grey('[')}${
25-
getAttribute(tag, 'checked', ' ') === '' ? red.bold('✓') : red.bold(' ')
25+
getAttribute(tag, 'checked', ' ') === '' ? green.bold('✓') : ' '
2626
}${grey(']')}`,
2727
post: null,
2828
type: 'inline',

lib/utils/get-theme.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const getTheme = (customTheme) => ({
1717
codeNumbers: (value) => style(customTheme.codeNumbers || 'blackBright dim', value),
1818

1919
dt: (value) => style(customTheme.dt || 'blue bold', value),
20+
dd: (value) => style(customTheme.dt || 'cyan', value),
2021
del: (value) => style(customTheme.del || 'bgRed black', value),
2122
ins: (value) => style(customTheme.ins || 'bgGreen black', value),
2223
italic: (value) => style(customTheme.italic || 'italic', value),

package.json

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cli-html",
3-
"version": "4.0.1",
3+
"version": "4.0.2",
44
"description": "Render HTML to Terminal",
55
"main": "index.js",
66
"type": "module",
@@ -35,39 +35,41 @@
3535
"ansi-escapes": "^6.2.0",
3636
"boxen": "^7.1.1",
3737
"chalk": "^5.3.0",
38-
"chalk-string": "^2.0.0",
39-
"change-case": "^4.1.2",
38+
"chalk-string": "^3.0.0",
39+
"change-case": "^5.3.0",
4040
"cli-highlight": "^2.1.11",
4141
"cli-table3": "^0.6.3",
4242
"color-namer": "^1.4.0",
4343
"compose-function": "^3.0.3",
4444
"concat-stream": "^2.0.0",
4545
"env-paths": "^3.0.0",
4646
"he": "^1.2.0",
47-
"inline-style-parser": "^0.1.1",
47+
"inline-style-parser": "^0.2.2",
4848
"languages-aliases": "^3.0.0",
4949
"longest-line": "0.0.3",
5050
"normalize-html-whitespace": "^1.0.0",
5151
"number-to-alphabet": "^1.0.0",
5252
"parse5": "^7.1.1",
5353
"romanize": "^1.1.1",
5454
"supports-hyperlinks": "^3.0.0",
55-
"term-size": "^3.0.1",
56-
"wrap-ansi": "^8.1.0",
57-
"yaml": "^2.3.1"
55+
"term-size": "^4.0.0",
56+
"wrap-ansi": "^9.0.0",
57+
"yaml": "^2.3.4"
5858
},
5959
"devDependencies": {
6060
"confusing-browser-globals": "^1.0.11",
61-
"eslint": "^8.44.0",
61+
"eslint": "^8.55.0",
6262
"eslint-config-airbnb-base": "^15.0.0",
6363
"eslint-config-standard-jsdoc": "^9.3.0",
6464
"eslint-plugin-async-await": "0.0.0",
65-
"eslint-plugin-jsdoc": "^46.4.3",
65+
"eslint-plugin-jsdoc": "^46.9.0",
6666
"eslint-plugin-json": "^3.1.0",
6767
"eslint-plugin-no-loops": "^0.3.0",
6868
"eslint-plugin-node": "^11.1.0",
69+
"eslint-plugin-perfectionist": "^2.5.0",
6970
"eslint-plugin-prefer-object-spread": "^1.2.1",
7071
"eslint-plugin-simple-import-sort": "^10.0.0",
71-
"eslint-plugin-unicorn": "^47.0.0"
72+
"eslint-plugin-unicorn": "^48.0.1",
73+
"globals": "^13.23.0"
7274
}
7375
}

0 commit comments

Comments
 (0)