@nbtca/prompt 1.0.26 → 1.0.27
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/dist/features/docs.js +3 -5
- package/package.json +1 -2
package/dist/features/docs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* 获取并渲染Markdown文档
|
|
4
4
|
*/
|
|
5
5
|
import { marked } from 'marked';
|
|
6
|
-
import
|
|
6
|
+
import { markedTerminal } from 'marked-terminal';
|
|
7
7
|
import chalk from 'chalk';
|
|
8
8
|
import open from 'open';
|
|
9
9
|
import { select, isCancel, confirm, text } from '@clack/prompts';
|
|
@@ -56,9 +56,7 @@ function ensureMarkedConfigured() {
|
|
|
56
56
|
if (_markedConfigured)
|
|
57
57
|
return;
|
|
58
58
|
_markedConfigured = true;
|
|
59
|
-
marked.use(
|
|
60
|
-
renderer: new TerminalRenderer(getRendererOptions(getTerminalType()))
|
|
61
|
-
});
|
|
59
|
+
marked.use(markedTerminal(getRendererOptions(getTerminalType())));
|
|
62
60
|
}
|
|
63
61
|
// ─── marked-terminal renderer ─────────────────────────────────────────────────
|
|
64
62
|
function getRendererOptions(type) {
|
|
@@ -293,7 +291,7 @@ function cleanMarkdownContent(content, type = getTerminalType()) {
|
|
|
293
291
|
if (type === 'basic') {
|
|
294
292
|
c = c.replace(/!\[([^\]]*)\]\([^)]+\)/g, (_, alt) => `${pickIcon('📎', '[image]')} ${alt || 'image'}`);
|
|
295
293
|
}
|
|
296
|
-
else
|
|
294
|
+
else {
|
|
297
295
|
c = c.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (_, alt, url) => {
|
|
298
296
|
const filename = url.split('/').pop() || url;
|
|
299
297
|
return `${pickIcon('🖼️', '[image]')} **${alt || 'image'}** _(${filename})_`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nbtca/prompt",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/gradient-string": "^1.1.6",
|
|
51
|
-
"@types/marked-terminal": "^3.1.3",
|
|
52
51
|
"@types/node": "^22.19.17",
|
|
53
52
|
"tsx": "^4.21.0",
|
|
54
53
|
"typescript": "^5.9.3"
|