cli-markdown
Advanced tools
Comparing version 3.3.0 to 3.4.0
95
index.js
@@ -31,3 +31,96 @@ /* eslint-disable import/no-extraneous-dependencies */ | ||
.use(alert, { | ||
deep: true, | ||
deep: false, | ||
openRender(tokens, index, options, environment, self) { | ||
const token = tokens[index]; | ||
let color = null; | ||
// Case token.markup in ['important', 'note', 'tip', 'warning', 'caution'] | ||
switch (token?.markup) { | ||
case 'important': { | ||
color = 'red'; | ||
break; | ||
} | ||
case 'note': { | ||
color = 'blue'; | ||
break; | ||
} | ||
case 'tip': { | ||
color = 'green'; | ||
break; | ||
} | ||
case 'warning': { | ||
color = 'yellow'; | ||
break; | ||
} | ||
case 'caution': { | ||
color = 'yellow light'; | ||
break; | ||
} | ||
default: { | ||
color = 'blue'; | ||
} | ||
} | ||
return `<blockquote class="x-cli-color-${color}">`; | ||
}, | ||
closeRender(tokens, index, options, environment, self) { | ||
return '</blockquote>'; | ||
}, | ||
titleRender: (tokens, index) => { | ||
const token = tokens[index]; | ||
// console.log(token) | ||
let color = null; | ||
let icon = null; | ||
switch (token?.markup) { | ||
case 'important': { | ||
color = 'red'; | ||
icon = '•'; | ||
break; | ||
} | ||
case 'note': { | ||
color = 'blue'; | ||
icon = '•'; | ||
break; | ||
} | ||
case 'tip': { | ||
color = 'green'; | ||
icon = '•'; | ||
break; | ||
} | ||
case 'warning': { | ||
color = 'yellow'; | ||
icon = '•'; | ||
break; | ||
} | ||
case 'caution': { | ||
color = 'yellow light'; | ||
icon = '•'; | ||
break; | ||
} | ||
default: { | ||
color = 'blue'; | ||
icon = '•'; | ||
} | ||
} | ||
return `<p><span class="x-cli-color-${color}"> ${ | ||
token.content[0].toUpperCase() + token.content.slice(1).toLowerCase() | ||
}</span></p>\n`; | ||
}, | ||
}); | ||
@@ -34,0 +127,0 @@ |
{ | ||
"name": "cli-markdown", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"type": "module", | ||
@@ -15,2 +15,6 @@ "description": "Render Markdown to Terminal", | ||
}, | ||
"engines": { | ||
"node": ">=16.0.0", | ||
"npm": ">=7.0.0" | ||
}, | ||
"scripts": { | ||
@@ -23,3 +27,3 @@ "test": "echo \"Error: no test specified\" && exit 0", | ||
"@types/marked": "^6.0.0", | ||
"cli-html": "^4.1.0", | ||
"cli-html": "^4.2.0", | ||
"concat-stream": "^2.0.0", | ||
@@ -55,6 +59,2 @@ "markdown-it": "^14.1.0", | ||
}, | ||
"engines": { | ||
"node": ">=16.0.0", | ||
"npm": ">=7.0.0" | ||
}, | ||
"author": "Grigorii Horos <horosgrisa@gmail.com>", | ||
@@ -61,0 +61,0 @@ "license": "GPL-3.0-or-later", |
65600
8
167
Updatedcli-html@^4.2.0