Comparing version 4.1.0 to 4.2.0
@@ -23,3 +23,2 @@ import { blockTag } from './tag-helpers/block-tag.js'; | ||
section, | ||
span, | ||
} from './tags/base-tags.js'; | ||
@@ -43,2 +42,3 @@ import { blockquote } from './tags/blockquote.js'; | ||
import { progress } from './tags/progress.js'; | ||
import { span } from './tags/span.js'; | ||
import { caption, table } from './tags/table.js'; | ||
@@ -45,0 +45,0 @@ import { |
@@ -10,3 +10,2 @@ import { blockTag } from '../tag-helpers/block-tag.js'; | ||
export const span = inline; | ||
export const label = inline; | ||
@@ -13,0 +12,0 @@ export const blink = inline; |
@@ -1,11 +0,23 @@ | ||
import compose from 'compose-function'; | ||
import chalkString from 'chalk-string'; | ||
import { blockTag } from '../tag-helpers/block-tag.js'; | ||
import { indentify } from '../utils.js'; | ||
import { getAttribute, getColorFromClass, indentify } from '../utils.js'; | ||
export const blockquote = (tag, context) => blockTag( | ||
compose( | ||
indentify(context.theme.blockquote('│ '), false), | ||
), | ||
{ marginTop: 1, marginBottom: 1 }, | ||
)(tag, { ...context, lineWidth: context.lineWidth - 2 }); | ||
const newStyle = chalkString(); | ||
export const blockquote = (tag, context) => { | ||
const classAttributes = getAttribute(tag, 'class', '') | ||
?.split(' ') | ||
?.find((classAttribute) => classAttribute.startsWith('x-cli-color-')); | ||
const color = getColorFromClass(classAttributes); | ||
return blockTag( | ||
indentify( | ||
color ? newStyle(color, '│ ') : context.theme.blockquote('│ '), | ||
false, | ||
), | ||
{ marginTop: 1, marginBottom: 1 }, | ||
)(tag, { ...context, lineWidth: context.lineWidth - 2 }); | ||
}; |
@@ -51,9 +51,9 @@ import chalk from 'chalk'; | ||
)( | ||
wrapAnsi(codeLine, context.lineWidth - pad.length - 2, { | ||
wrapAnsi(`|${codeLine}|`, context.lineWidth - pad.length - 2, { | ||
trim: true, | ||
}), | ||
}).slice(1, -1), | ||
)}`, | ||
); | ||
return indentify('', false)(codeContent.join('\n')); | ||
return indentify(' ', false)(codeContent.join('\n')); | ||
})(tag, context); | ||
@@ -60,0 +60,0 @@ |
@@ -64,1 +64,9 @@ export const filterAst = (ast) => { | ||
}; | ||
export const getColorFromClass = (classAttribute = '') => { | ||
if (classAttribute?.startsWith('x-cli-color-')) { | ||
return classAttribute?.slice(12); | ||
} | ||
return null; | ||
}; |
{ | ||
"name": "cli-html", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "Render HTML to Terminal", | ||
@@ -14,2 +14,6 @@ "main": "index.js", | ||
}, | ||
"engines": { | ||
"node": ">=16.0.0", | ||
"npm": ">=7.0.0" | ||
}, | ||
"author": "Grigorii Horos", | ||
@@ -29,3 +33,2 @@ "license": "GPL3", | ||
}, | ||
"engines": {}, | ||
"homepage": "https://github.com/horosgrisa/cli-html", | ||
@@ -32,0 +35,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
246025
47
1364