I am trying to get the rainbow syntax highlighting library to work with the marked markdown rendering engine. The marked
documentation states that a syntax highlighter is supported through the following configuration option:
marked.setOptions({
highlight: function(code, lang) {
return highlighter.javascript(code);
}
});
The rainbow
source code indicates that passing in a string to highlight is supported via the following syntax:
Rainbow.color(code, lang, success);
I'm a bit at a loss as to how to put the two together. Specifically, success
is a callback that will be called asynchronously, and I can't simply return the value from the Rainbow.color
code inside the highlight
callback. How would this be accomplished?