That seems like a roundabout way to do things. The web tells me: "The asciidoctor.js project is a direct port of Asciidoctor from Ruby to JavaScript using the Opal Ruby-to-JavaScript cross compiler"
Why don't you use JRuby and run the original Asciidoctor code directly in a background thread? That way, no webview is needed and it can all be done in the background.