title: How to convert HTML to image in Node.js
body: <p>I need to convert an HTML template into an image, on a Node server.
  The server will receive the HTML as a string. I tried PhantomJS (using a library called Webshot), but it doesn't work well with flex box and modern CSS. I tried to use Chrome headless-browser but it doesn't seem to have an API for parsing html, only URL.</p>
  <p>What is the currently best way to convert a piece of HTML into image?</p>
  <p>Is there a way to use headless Chrome in a template mode instead of URL mode? I mean, instead of doing something like</p>
  <pre><code>chrome.goTo('http://test.com')
  </code></pre>
  <p>I need something like:</p>
  <pre><code>chrome.evaluate('&lt;div&gt;hello world&lt;/div&gt;');
  </code></pre>
  <p>Another option, suggested here in the comments to this post, is to
  save the template in a file on the server and then serve it locally and do something like:</p>
  <pre><code>chrome.goTo('http://localhost/saved_template');
  </code></pre>
  <p>But this option sounds a bit awkward. Is there any other, more straightforward solution?</p>