How to use the marked-terminal function in marked-terminal

To help you get started, we’ve selected a few marked-terminal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github umijs / umi / packages / umi-core / src / error.js View on Github external
import chalk from 'chalk';
import signale from 'signale';
import marked from 'marked';
import TerminalRenderer from 'marked-terminal';
import { existsSync, writeFileSync } from 'fs';

marked.setOptions({
  renderer: new TerminalRenderer(),
});

// 支持内部框架扩展 error code map
const ERROR_CODE_MAP = require(process.env.ERROR_CODE_MAP_PATH || '@umijs/error-code-map');

export class UmiError extends Error {
  constructor(opts, ...params) {
    const { message, code, context } = opts;
    super(message, ...params);
    this.code = code;
    this.context = context || {};

    this.test();
  }

  test() {
github SnowdogApps / magento2-frontools / tasks / default.js View on Github external
export default function(callback) {
  // Display formatted readme.md
  marked.setOptions({
    renderer: new markedTerminal()
  })

  log.info(marked(fs.readFileSync('./README.md', 'UTF-8')))

  callback()
}
github sQVe / 30s / src / printer.js View on Github external
import Renderer from 'marked-terminal'
import chalk from 'chalk'
import marked from 'marked'
import { compose, is, join, map, pick, prop, replace, toPairs } from 'ramda'
import { highlight } from 'cli-highlight'
import { writeSync as writeToClipboard } from 'clipboardy'

import { enforceSingleNewLine } from './helpers'

marked.setOptions({ renderer: new Renderer() })

export const colorizedPrint = x => {
  const printMap = {
    code: y => highlight(y, { language: 'javascript' }),
    description: y => enforceSingleNewLine(marked(y)),
    example: y => highlight(y, { language: 'javascript' }),
    id: y => chalk.magenta.bold(y),
    tags: compose(
      chalk.gray.italic,
      join(', ')
    ),
  }
  const print = y =>
    compose(
      replace(/\n$/, ''),
      join('\n'),
github twilio / flex-plugin-builder / packages / flex-dev-utils / src / marked.ts View on Github external
import marked from 'marked';
import TerminalRenderer from 'marked-terminal';
import { pipe } from '@k88/pipe-compose';

import { readFileSync } from './fs';
import * as logger from './logger';

marked.setOptions({
  renderer: new TerminalRenderer(),
});

/**
 * Renders the markdown file
 *
 * @param filePath  path to markdown file
 */
export const render = (filePath: string) => pipe(filePath, readFileSync, marked, logger.info);

export default marked;
github microsoft / just / packages / just-scripts-utils / src / prettyPrintMarkdown.ts View on Github external
export function prettyPrintMarkdown(content: string): string {
  if (typeof content !== 'string') {
    return '';
  }
  marked.setOptions({
    renderer: new TerminalRenderer()
  });
  return marked(content);
}

marked-terminal

A custom render for marked to output to the Terminal

MIT
Latest version published 2 months ago

Package Health Score

85 / 100
Full package analysis

Popular marked-terminal functions