lib/phantomscript.js
// The sandboxed function that's executed in-page by phantom
The sandboxed function that's executed in-page by phantom
The sandboxed function that ' s executed in - page by phantom
function executeInPage(contents) {
  var xmlSerializer = new XMLSerializer()
    , toRemove
    , el
    , elContent
    , svg
    , svgValue
  toRemove = document.getElementsByClassName('mermaid')
  if (toRemove && toRemove.length) {
    for (var i = 0, len = toRemove.length; i < len; i++) {
      toRemove[i].parentNode.removeChild(toRemove[i])
    }
  }
  el = document.createElement("div")
  el.className = 'mermaid'
  elContent = document.createTextNode(contents)
  el.appendChild(elContent)
  document.body.appendChild(el)
  mermaid.init()
  svg = document.querySelector('svg')
  svgValue = xmlSerializer.serializeToString(svg)
  return svgValue
}
function executeInPage ( contents ) { var xmlSerializer = new XMLSerializer ( ) , toRemove , el , elContent , svg , svgValue toRemove = document . getElementsByClassName ( 'mermaid' ) if ( toRemove && toRemove . length ) { for ( var i = 0 , len = toRemove . length ; i < len ; i ++ ) { toRemove [ i ] . parentNode . removeChild ( toRemove [ i ] ) } } el = document . createElement ( "div" ) el . className = 'mermaid' elContent = document . createTextNode ( contents ) el . appendChild ( elContent ) document . body . appendChild ( el ) mermaid . init ( ) svg = document . querySelector ( 'svg' ) svgValue = xmlSerializer . serializeToString ( svg ) return svgValue }
The sandboxed function that's executed in-page by phantom
The sandboxed function that ' s executed in - page by phantom