init = function init() {
  var conf = _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].getConfig();
  _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Starting rendering diagrams');
  var nodes;

  if (arguments.length >= 2) {
    /*! sequence config was passed as #1 */
    if (typeof arguments[0] !== 'undefined') {
      mermaid.sequenceConfig = arguments[0];
    }

    nodes = arguments[1];
  } else {
    nodes = arguments[0];
  } // if last argument is a function this is the callback function


  var callback;

  if (typeof arguments[arguments.length - 1] === 'function') {
    callback = arguments[arguments.length - 1];
    _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Callback function found');
  } else {
    if (typeof conf.mermaid !== 'undefined') {
      if (typeof conf.mermaid.callback === 'function') {
        callback = conf.mermaid.callback;
        _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Callback function found');
      } else {
        _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('No Callback function found');
      }
    }
  }

  nodes = nodes === undefined ? document.querySelectorAll('.mermaid') : typeof nodes === 'string' ? document.querySelectorAll(nodes) : nodes instanceof window.Node ? [nodes] : nodes; // Last case  - sequence config was passed pick next

  _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Start On Load before: ' + mermaid.startOnLoad);

  if (typeof mermaid.startOnLoad !== 'undefined') {
    _logger__WEBPACK_IMPORTED_MODULE_2__["logger"].debug('Start On Load inner: ' + mermaid.startOnLoad);
    _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].initialize({
      startOnLoad: mermaid.startOnLoad
    });
  }

  if (typeof mermaid.ganttConfig !== 'undefined') {
    _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].initialize({
      gantt: mermaid.ganttConfig
    });
  }

  var txt;

  var _loop = function _loop(i) {
    var element = nodes[i];
    /*! Check if previously processed */

    if (!element.getAttribute('data-processed')) {
      element.setAttribute('data-processed', true);
    } else {
      return "continue";
    }

    var id = "mermaid-".concat(Date.now()); // Fetch the graph definition including tags

    txt = element.innerHTML; // transforms the html to pure text

    txt = he__WEBPACK_IMPORTED_MODULE_0___default.a.decode(txt).trim().replace(/<br\s*\/?>/gi, '<br/>');
    _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].render(id, txt, function (svgCode, bindFunctions) {
      element.innerHTML = svgCode;

      if (typeof callback !== 'undefined') {
        callback(id);
      }

      if (bindFunctions) bindFunctions(element);
    }, element);
  };

  for (var i = 0; i < nodes.length; i++) {
    var _ret = _loop(i);

    if (_ret === "continue") continue;
  }
}
## init
Function that goes through the document to find the chart definitions in there and render them.

The function tags the processed attributes with the attribute data-processed and ignores found elements with the
attribute already set. This way the init function can be triggered several times.

Optionally, `init` can accept in the second argument one of the following:
- a DOM Node
- an array of DOM nodes (as would come from a jQuery selector)
- a W3C selector, a la `.mermaid`

```mermaid
graph LR;
 a(Find elements)-->b{Processed}
 b-->|Yes|c(Leave element)
 b-->|No |d(Transform)
```
Renders the mermaid diagrams
@param nodes a css selector or an array of nodes