Skip to content

Commit 265ad71

Browse files
Update
1 parent 209587e commit 265ad71

File tree

4 files changed

+57
-53
lines changed

4 files changed

+57
-53
lines changed

lib/tags/a.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import ansiEscapes from 'ansi-escapes';
2-
import { stdout } from 'supports-hyperlinks';
3-
2+
import supportsHyperlinks from "supports-hyperlinks";
43
import inlineTag from '../tag-helpers/inline-tag.js';
54
import { getAttribute } from '../utils.js';
65

@@ -25,7 +24,10 @@ export const a = inlineTag((value, tag, context) => {
2524

2625
const linkText = context.theme.a(value);
2726

28-
const linkValue = stdout && href ? ansiEscapes.link(linkText, href) : linkText;
27+
const linkValue =
28+
supportsHyperlinks.stdout && href
29+
? ansiEscapes.link(linkText, href)
30+
: linkText;
2931

3032
return linkValue;
3133
});

lib/tags/span.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import ansiEscapes from 'ansi-escapes';
2-
import chalkString from 'chalk-string';
3-
import { stdout } from 'supports-hyperlinks';
2+
import chalkString from "chalk-string";
43

54
import inlineTag from '../tag-helpers/inline-tag.js';
65
import { getAttribute, getColorFromClass } from '../utils.js';

lib/utils/get-theme.js

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,47 @@ import chalkString from 'chalk-string';
33
const newStyle = chalkString();
44

55
// @ts-ignore
6-
const style = (styleString = '', value = '') => newStyle(styleString, value);
6+
const style = (styleString = "", value = "") =>
7+
styleString ? newStyle(styleString, value) : value;
78

89
export const getTheme = (customTheme) => ({
9-
h1: (value) => style(customTheme.h1 || 'red bold', value),
10-
h2: (value) => style(customTheme.h2 || 'blue bold', value),
11-
h3: (value) => style(customTheme.h3 || 'blue bold', value),
12-
h4: (value) => style(customTheme.h4 || 'cyan bold', value),
13-
h5: (value) => style(customTheme.h5 || 'cyan', value),
14-
h6: (value) => style(customTheme.h6 || 'cyan', value),
10+
h1: (value) => style(customTheme.h1 || "red bold", value),
11+
h2: (value) => style(customTheme.h2 || "blue bold", value),
12+
h3: (value) => style(customTheme.h3 || "blue bold", value),
13+
h4: (value) => style(customTheme.h4 || "cyan bold", value),
14+
h5: (value) => style(customTheme.h5 || "cyan", value),
15+
h6: (value) => style(customTheme.h6 || "cyan", value),
1516

1617
//
17-
a: (value) => style(customTheme.a || 'blue underline', value),
18-
figcaption: (value) => style(customTheme.figcaption || 'bgGreen bold', value),
19-
blockquote: (value) => style(customTheme.blockquote || 'black', value),
18+
a: (value) => style(customTheme.a || "blue underline", value),
19+
figcaption: (value) => style(customTheme.figcaption || "bgGreen bold", value),
20+
blockquote: (value) => style(customTheme.blockquote || "black", value),
2021

2122
// CODE
22-
code: (value) => style(customTheme.inlineCode || 'yellowBright', value),
23-
inlineCode: (value) => style(customTheme.inlineCode || 'bgBlack', value),
24-
codeNumbers: (value) => style(customTheme.codeNumbers || 'blackBright dim', value),
25-
26-
dt: (value) => style(customTheme.dt || 'blue bold', value),
27-
dd: (value) => style(customTheme.dt || 'cyan', value),
28-
dl: (value) => style(customTheme.dl || '', value),
29-
30-
del: (value) => style(customTheme.del || 'bgRed black', value),
31-
ins: (value) => style(customTheme.ins || 'bgGreen black', value),
32-
strike: (value) => style(customTheme.strikethrough || 'strikethrough', value),
33-
underline: (value) => style(customTheme.underline || 'underline', value),
34-
bold: (value) => style(customTheme.bold || 'bold', value),
35-
samp: (value) => style(customTheme.samp || 'yellowBright', value),
36-
kbd: (value) => style(customTheme.kbd || 'bgBlack', value),
37-
var: (value) => style(customTheme.variableTag || 'blue italic', value),
38-
mark: (value) => style(customTheme.mark || 'bgYellow black', value),
39-
time: (value) => style(customTheme.mark || 'cyan', value),
23+
code: (value) => style(customTheme.inlineCode || "yellowBright", value),
24+
inlineCode: (value) => style(customTheme.inlineCode || "bgBlack", value),
25+
codeNumbers: (value) =>
26+
style(customTheme.codeNumbers || "blackBright dim", value),
27+
28+
dt: (value) => style(customTheme.dt || "blue bold", value),
29+
dd: (value) => style(customTheme.dt || "cyan", value),
30+
dl: (value) => style(customTheme.dl || "", value),
31+
32+
del: (value) => style(customTheme.del || "bgRed black", value),
33+
ins: (value) => style(customTheme.ins || "bgGreen black", value),
34+
strike: (value) => style(customTheme.strikethrough || "strikethrough", value),
35+
underline: (value) => style(customTheme.underline || "underline", value),
36+
bold: (value) => style(customTheme.bold || "bold", value),
37+
samp: (value) => style(customTheme.samp || "yellowBright", value),
38+
kbd: (value) => style(customTheme.kbd || "bgBlack", value),
39+
var: (value) => style(customTheme.variableTag || "blue italic", value),
40+
mark: (value) => style(customTheme.mark || "bgYellow black", value),
41+
time: (value) => style(customTheme.mark || "cyan", value),
4042

4143
//
42-
italic: (value) => style(customTheme.italic || 'italic', value),
43-
i: (value) => style(customTheme.i || customTheme.italic || 'italic', value),
44-
em: (value) => style(customTheme.em || customTheme.italic || 'italic', value),
45-
cite: (value) => style(customTheme.cite || customTheme.italic || 'italic', value),
44+
italic: (value) => style(customTheme.italic || "italic", value),
45+
i: (value) => style(customTheme.i || customTheme.italic || "italic", value),
46+
em: (value) => style(customTheme.em || customTheme.italic || "italic", value),
47+
cite: (value) =>
48+
style(customTheme.cite || customTheme.italic || "italic", value),
4649
});

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,43 @@
3333
"dependencies": {
3434
"ansi-align": "^3.0.1",
3535
"ansi-escapes": "^7.0.0",
36-
"boxen": "^7.1.1",
37-
"chalk": "^5.3.0",
38-
"chalk-string": "^3.0.0",
36+
"boxen": "^8.0.1",
37+
"chalk": "^5.4.1",
38+
"chalk-string": "^3.0.1",
3939
"change-case": "^5.4.4",
4040
"cli-highlight": "^2.1.11",
41-
"cli-table3": "^0.6.4",
41+
"cli-table3": "^0.6.5",
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.2.3",
47+
"inline-style-parser": "^0.2.4",
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",
52-
"parse5": "^7.1.1",
52+
"parse5": "^7.3.0",
5353
"romanize": "^1.1.1",
54-
"supports-hyperlinks": "^3.0.0",
54+
"supports-hyperlinks": "^4.1.0",
5555
"term-size": "^4.0.0",
5656
"wrap-ansi": "^9.0.0",
57-
"yaml": "^2.4.2"
57+
"yaml": "^2.8.0"
5858
},
5959
"devDependencies": {
6060
"confusing-browser-globals": "^1.0.11",
61-
"eslint": "^8.57.0",
61+
"eslint": "^9.28.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": "^48.2.4",
66-
"eslint-plugin-json": "^3.1.0",
67-
"eslint-plugin-no-loops": "^0.3.0",
65+
"eslint-plugin-jsdoc": "^50.7.1",
66+
"eslint-plugin-json": "^4.0.1",
67+
"eslint-plugin-no-loops": "^0.4.0",
6868
"eslint-plugin-node": "^11.1.0",
69-
"eslint-plugin-perfectionist": "^2.10.0",
69+
"eslint-plugin-perfectionist": "^4.14.0",
7070
"eslint-plugin-prefer-object-spread": "^1.2.1",
71-
"eslint-plugin-simple-import-sort": "^12.1.0",
72-
"eslint-plugin-unicorn": "^53.0.0",
73-
"globals": "^15.2.0"
71+
"eslint-plugin-simple-import-sort": "^12.1.1",
72+
"eslint-plugin-unicorn": "^59.0.1",
73+
"globals": "^16.2.0"
7474
}
7575
}

0 commit comments

Comments
 (0)