cli-html
Version:
Render HTML to Terminal
35 lines (23 loc) • 733 B
JavaScript
import chalk from 'chalk';
import inlineTag from '../tag-helpers/inline-tag.js';
import { getAttribute } from '../utils.js';
const {
underline, grey, cyan, italic,
} = chalk;
export const abbr = inlineTag((value, tag) => {
const title = getAttribute(tag, 'title', null);
let abbrValue = underline(value);
abbrValue = title
? `${abbrValue} ${grey('(')}${cyan(title)}${grey(')')}`
: abbrValue;
return abbrValue;
});
export const dfn = inlineTag((value, tag) => {
const title = getAttribute(tag, 'title', null);
let abbrValue = italic.underline(value);
abbrValue = title
? `${abbrValue} ${grey('(')}${cyan(title)}${grey(')')}`
: abbrValue;
return abbrValue;
});
export const acronym = abbr;