Open felipenmoura opened 8 years ago
@felipenmoura Your last example should work so long as you are passing a valid theme object.
The problem seems to be that the theme is properly resolved only when using the CLI.
Cardinal uses redeyed to do the highlighting here. Essentially, this is the call:
redeyed(code, opts.theme || theme)
It is expected that theme
is an object. However, when you pass options to cardinal.highlight()
, as in your second example, you are passing theme
as a string and redeyed barfs.
This library should be fixed to handle theme options the same whether from the CLI or used programmatically.
I'm trying to customize it, but when I simply add the
theme
option, it stops highlighting!For example:
But:
Am I doing something wrong?
My idea is to use it like this:
Should that work? Also, it would be interesting if we could send the theme object itself, like this: