       if options.matplotlib or options.mpl
         scriptElements = outputDiv.getElementsByTagName('script')
         if scriptElements.length
-          window.d3 = require('../dependencies/mpld3/d3.v3.min.js')
-          window.mpld3 = require('../dependencies/mpld3/mpld3.v0.3.min.js')
+          window.d3 ?= require('../dependencies/mpld3/d3.v3.min.js')
+          window.mpld3 ?= require('../dependencies/mpld3/mpld3.v0.3.min.js')
           for scriptElement in scriptElements
             code = scriptElement.innerHTML
             allowUnsafeNewFunction -> allowUnsafeEval ->

  ## {Function} callback (htmlContent)
  insertCodeChunksResult: (htmlContent)->
    # insert outputDiv and outputElement accordingly
    $ = cheerio.load(htmlContent)
    codeChunks = $('.code-chunk')
    jsCode = ''
    requireCache = {} # key is path
    scriptsStr = ""
    stylesStr = ""

    # codeChunksArr = []
    for codeChunk in codeChunks
      $codeChunk = $(codeChunk)
      dataArgs = $codeChunk.attr('data-args').unescape()

katex = require 'katex'
matter = require('gray-matter')
{allowUnsafeEval, allowUnsafeNewFunction} = require 'loophole'
cheerio = null

{getMarkdownPreviewCSS} = require './style'
plantumlAPI = require './puml'
