title: Markdown syntax highlighting in Javascript
body: <p>I am trying to get the <a href="https://github.com/ccampbell/rainbow" rel="noreferrer">rainbow</a> syntax highlighting library to work with the <a href="https://github.com/chjj/marked" rel="noreferrer">marked</a> markdown rendering engine. The <code>marked</code> documentation states that a syntax highlighter is supported through the following configuration option:</p>
  
  <pre><code>marked.setOptions({
    highlight: function(code, lang) {
      return highlighter.javascript(code);
    }
  });
  </code></pre>
  
  <p>The <code>rainbow</code> <a href="https://github.com/ccampbell/rainbow/blob/master/js/rainbow.js#L740" rel="noreferrer">source code</a> indicates that passing in a string to highlight is supported via the following syntax:</p>
  
  <pre><code>Rainbow.color(code, lang, success);
  </code></pre>
  
  <p>I'm a bit at a loss as to how to put the two together. Specifically, <code>success</code> is a callback that will be called asynchronously, and I can't simply return the value from the <code>Rainbow.color</code> code inside the <code>highlight</code> callback. How would this be accomplished?</p>