Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including marked-terminal with all npm packages installed. Try it out:

require("marked/package.json"); // marked is a peer dependency. var markedTerminal = require("marked-terminal")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

marked-terminal v4.0.0

A custom render for marked to output to the Terminal


Custom Renderer for marked allowing for printing Markdown to the Terminal. Supports pretty tables, syntax highlighting for javascript, and overriding all colors and styles.

Could for instance be used to print usage information.

Build Status npm marked-terminal


npm install marked marked-terminal


var marked = require('marked');
var TerminalRenderer = require('marked-terminal');

  // Define custom renderer
  renderer: new TerminalRenderer()

// Show the parsed data
console.log(marked('# Hello \n This is **markdown** printed in the `terminal`'));

This will produce the following:

Screenshot of marked-terminal

Syntax Highlighting

Also have support for syntax highlighting using cardinal. You can override highlight defaults by passing in settings as the second argument for TerminalRenderer, or you can create a .cardinalrc as defined in the cardinal README.

Having the following markdown input:

var foo = function(bar) {

...we will convert it into terminal format:

// Show the parsed data

This will produce the following:

Screenshot of marked-terminal


Constructur: new TerminalRenderer([options][, highlightOptions])


Optional Used to override default styling.

Default values are:

var defaultOptions = {
  // Colors
  code: chalk.yellow,
  blockquote: chalk.gray.italic,
  html: chalk.gray,
  firstHeading: chalk.magenta.underline.bold,
  hr: chalk.reset,
  listitem: chalk.reset,
  table: chalk.reset,
  paragraph: chalk.reset,
  strong: chalk.bold,
  em: chalk.italic,
  codespan: chalk.yellow,
  del: chalk.dim.gray.strikethrough,

  // Formats the bulletpoints and numbers for lists
  list: function (body, ordered) {/* ... */},

  // Reflow and print-out width
  width: 80, // only applicable when reflow is true
  reflowText: false,

  // Should it prefix headers?
  showSectionPrefix: true,

  // Whether or not to undo marked escaping
  // of enitities (" -> " etc)
  unescape: true,

  // Whether or not to show emojis
  emoji: true,

  // Options passed to cli-table
  tableOptions: {},

  // The size of tabs in number of spaces or as tab characters
  tab: 3 // examples: 4, 2, \t, \t\t

  image: function (href, title, text) {} // function for overriding the default image handling.

Example of overriding defaults

  renderer: new TerminalRenderer({
    codespan: chalk.underline.magenta,


Options passed into cardinal. See readme there to see what options to pass.

See more examples

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free