How to use @parcel/markdown-ansi - 3 common examples

To help you get started, we’ve selected a few @parcel/markdown-ansi 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 parcel-bundler / parcel / packages / core / utils / src / prettyDiagnostic.js View on Github external
codeFrame,
    hints,
    filePath,
    language,
    skipFormatting,
  } = diagnostic;

  let result = {
    message: '',
    stack: '',
    codeframe: '',
    hints: [],
  };

  result.message =
    mdAnsi(`**${origin ?? 'unknown'}**: `) +
    (skipFormatting ? message : mdAnsi(message));
  result.stack = stack || '';

  if (codeFrame !== undefined) {
    let highlights = Array.isArray(codeFrame.codeHighlights)
      ? codeFrame.codeHighlights
      : [codeFrame.codeHighlights];

    let formattedCodeFrame = formatCodeFrame(codeFrame.code, highlights, {
      useColor: true,
      syntaxHighlighting: true,
      language:
        // $FlowFixMe sketchy null checks do not matter here...
        language || (filePath ? path.extname(filePath).substr(1) : undefined),
    });
github parcel-bundler / parcel / packages / core / utils / src / prettyDiagnostic.js View on Github external
hints,
    filePath,
    language,
    skipFormatting,
  } = diagnostic;

  let result = {
    message: '',
    stack: '',
    codeframe: '',
    hints: [],
  };

  result.message =
    mdAnsi(`**${origin ?? 'unknown'}**: `) +
    (skipFormatting ? message : mdAnsi(message));
  result.stack = stack || '';

  if (codeFrame !== undefined) {
    let highlights = Array.isArray(codeFrame.codeHighlights)
      ? codeFrame.codeHighlights
      : [codeFrame.codeHighlights];

    let formattedCodeFrame = formatCodeFrame(codeFrame.code, highlights, {
      useColor: true,
      syntaxHighlighting: true,
      language:
        // $FlowFixMe sketchy null checks do not matter here...
        language || (filePath ? path.extname(filePath).substr(1) : undefined),
    });

    result.codeframe +=

@parcel/markdown-ansi

Blazing fast, zero configuration web application bundler

MIT
Latest version published 2 months ago

Package Health Score

80 / 100
Full package analysis

Popular @parcel/markdown-ansi functions

Similar packages