Skip to content

Commit 6baaf04

Browse files
Fix code tag
1 parent 953e8b4 commit 6baaf04

File tree

5 files changed

+4
-12
lines changed

5 files changed

+4
-12
lines changed

bin/html.js

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

3-
import { createReadStream } from 'node:fs';
43
import concat from 'concat-stream';
4+
import { createReadStream } from 'node:fs';
55

66
import cliHtml from '../index.js';
77

lib/tag-helpers/block-tag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function blockTag(wrapper, localContext) {
9494
? value.block.marginBottom
9595
: bottomBlock,
9696
type: 'block',
97-
nodeName: tag.nodeName,
97+
// nodeName: tag.nodeName,
9898
};
9999
};
100100
}

lib/tag-helpers/inline-tag.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ const inlineTag = (wrapper) => (tag, context) => {
1010
}
1111

1212
const value = tag.childNodes.reduce((accumulator, node) => {
13-
// const tagFunction = tags[node.nodeName || '#text'] || tags.span;
14-
// const nodeTag = tagFunction(node, context);
15-
1613
const nodeTag = renderTag(node, context, tags.span);
1714

1815
if (!nodeTag) {
@@ -26,11 +23,6 @@ const inlineTag = (wrapper) => (tag, context) => {
2623
};
2724
}, null);
2825

29-
// if (!value) {
30-
// return value;
31-
// }
32-
33-
// if (value.value) {
3426
return {
3527
pre: value?.pre ? wrapFunction(value.pre, tag, context) : null,
3628
value: wrapFunction(value?.value, tag, context),

lib/tags/code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const code = (tag, context) => inlineTag((value, tag) => {
4646
pad,
4747
true,
4848
)(
49-
wrapAnsi(codeLine, context.lineWidth - codeLinesLength - 1, { trim: true }),
49+
wrapAnsi(codeLine, context.lineWidth - codeLinesLength - 1, { trim: false }),
5050
)}`,
5151
);
5252

lib/wrap-line-width.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import wrapAnsi from 'wrap-ansi';
22

3-
const wrapLineWidth = (text, tag) => wrapAnsi(text, tag.lineWidth, { trim: !tag.pre });
3+
const wrapLineWidth = (text, context) => wrapAnsi(text, context.lineWidth, { trim: !context.pre });
44

55
export default wrapLineWidth;

0 commit comments

Comments
 (0)