UNPKG

cli-html-c

Version:

There will be cli module who render HTML to Terminal

18 lines (13 loc) 415 B
const ansiStyles = require('ansi-colors'); const { getAttribute } = require('../utils'); const img = (tag) => { const text = getAttribute(tag, 'alt', null) || getAttribute(tag, 'title', null) || 'Image'; return { pre: null, value: ansiStyles.cyan('!') + ansiStyles.grey('[') + ansiStyles.cyan(text) + ansiStyles.grey(']'), post: null, type: 'inline', }; }; module.exports.img = img;