diff --git a/examples/special.js b/examples/special.js index 74a9442..88fa972 100755 --- a/examples/special.js +++ b/examples/special.js @@ -18,6 +18,8 @@ consola.error({ type: 'CSSError', message: 'Use scss' }) consola.error(undefined, null, false, true, NaN) +consola.log('We can `monospace` keyword using grave accent charachter!') + // Nonstandard error const { message, stack } = new Error('Custom Error!') consola.error({ message, stack }) diff --git a/src/reporters/fancy.js b/src/reporters/fancy.js index 4af8fe7..9202aee 100644 --- a/src/reporters/fancy.js +++ b/src/reporters/fancy.js @@ -1,5 +1,6 @@ import stringWidth from 'string-width' import figures from 'figures' +import chalk from 'chalk' import BasicReporter from './basic' import { parseStack } from '../utils/error' import { chalkColor, chalkBgColor } from '../utils/chalk' @@ -77,6 +78,8 @@ export default class FancyReporter extends BasicReporter { line += additional.length ? '\n' + additional.join('\n') : '' + line = line.replace(/`(.+)`/g, (_, m) => chalk.cyan(m)) + return isBadge ? '\n' + line + '\n' : line } }