mikaelbr/marked-terminal

Add ability to use themes

mikaelbr opened this issue · 0 comments

Now we have a hard coded set if colors but it is easily overridable/expandable. A cool feature would be to have built in themes and easily plugging in external themes for colors.

Example API:

marked.setOptions({
  renderer: new TerminalRenderer({
    theme: 'named-build-in-theme'
  })
});

or

const theme = {
  code: chalk.yellow,
  blockquote: chalk.gray.italic,
  html: chalk.gray,
};
marked.setOptions({
  renderer: new TerminalRenderer({
    theme: theme 
  })
});

The latter example is more or less just a variation of Object.assign but with some logic/validation to not override some other options.