ispbills-icli 4.0.1 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/chat.js +13 -4
package/package.json
CHANGED
package/src/chat.js
CHANGED
|
@@ -24,18 +24,27 @@ const P = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
// ── Markdown ───────────────────────────────────────────────────────────────────
|
|
27
|
-
|
|
27
|
+
const termRenderer = new TerminalRenderer({
|
|
28
28
|
firstHeading: chalk.bold.white,
|
|
29
29
|
heading: chalk.bold.white,
|
|
30
30
|
strong: chalk.bold.white,
|
|
31
31
|
em: chalk.italic.hex('#9198A1'),
|
|
32
32
|
codespan: (t) => chalk.bgHex('#161b22').hex('#c9d1d9')(` ${t} `),
|
|
33
33
|
code: (t) => '\n' + t.split('\n').map(l => ' ' + chalk.hex('#a5d6ff')(l)).join('\n') + '\n',
|
|
34
|
-
blockquote: (t) => P.dim('
|
|
35
|
-
listitem: (t) => ` ${P.accent('·')} ${t.trimEnd()}`,
|
|
34
|
+
blockquote: (t) => P.dim('▌ ') + P.dim(t.trim()) + '\n',
|
|
36
35
|
hr: () => P.border('─'.repeat(inner())) + '\n',
|
|
37
36
|
link: (_h, _t, t) => chalk.hex('#58a6ff').underline(t || _h),
|
|
38
|
-
})
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Override listitem on the instance — the options.listitem is a chalk color, not a renderer fn
|
|
40
|
+
const _origListitem = termRenderer.listitem.bind(termRenderer);
|
|
41
|
+
termRenderer.listitem = function(item) {
|
|
42
|
+
const raw = _origListitem(item);
|
|
43
|
+
// Replace the default ' * ' or ' - ' bullet with our accent '·'
|
|
44
|
+
return raw.replace(/^\s*[*\-]\s/, (m) => m.replace(/[*\-]/, P.accent('·')));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
marked.setOptions({ renderer: termRenderer });
|
|
39
48
|
|
|
40
49
|
function renderMarkdown(text) {
|
|
41
50
|
try { return marked(text).trimEnd(); } catch { return text; }
|