docs: function (pattern, givenPath) {
      var data         = { "pattern": pattern };
      var fileName     = urlHandler.getFileName(pattern);
      var path         = window.location.pathname;
      path             = (window.location.protocol === "file") ? path.replace("/public/index.html","public/") : path.replace(/\/index\.html/,"/");
      var expectedPath = window.location.protocol+"//"+window.location.host+path+fileName;
      if (givenPath != expectedPath) {
        // make sure to update the iframe because there was a click
        var obj = JSON.stringify({ "event": "patternLab.updatePath", "path": fileName });
        document.getElementById("sg-viewport").contentWindow.postMessage(obj, urlHandler.targetOrigin);
      } else {
        // add to the history
        var addressReplacement = (window.location.protocol == "file:") ? null : window.location.protocol+"//"+window.location.host+window.location.pathname.replace("index.html","")+"?p="+pattern;
        if (history.pushState !== undefined) {
          history.pushState(data, null, addressReplacement);
        }
        document.getElementById("title").innerHTML = "Pattern Lab - "+pattern;
        if (document.getElementById("sg-raw") !== null) {
          document.getElementById("sg-raw").setAttribute("href",urlHandler.getFileName(pattern));
        }
      }
    }