marked.setOptions({
  langPrefix: 'language-',
  highlight: function(code, lang) {
    if (!Prism.languages[lang]) {
      return code;
    }
    return Prism.highlight(code, Prism.languages[lang]);
  },
  renderer: (function(){
    var renderMin = new marked.Renderer();
    renderMin.table = function(header, body) {
      return '<table class=\'table\'>\n'
      + '<thead>\n'
      + header
      + '</thead>\n'
      + '<tbody>\n'
      + body
      + '</tbody>\n'
      + '</table>\n';
    };
    return renderMin;
  })()
});

var md = document.getElementById('md');
md.innerHTML = marked(md.getAttribute('data-md'));

marked.setOptions({
  langPrefix: 'language-',
  highlight: function(code, lang) {
    if (!Prism.languages[lang]) {
      return code;
    }
    return Prism.highlight(code, Prism.languages[lang]);
  },
});

var md = document.getElementById('md');
md.innerHTML = marked(md.getAttribute('data-md'));

(function() {
  var tables = document.querySelectorAll('table');
  for (var i = 0, tableElement ; tableElement = tables[i++] ; ) {
    tableElement.className = 'table';
  }
})();

Move table class to postprocessing step
Move table class to postprocessing step

We don't want to do this as part of markdown rendering, because it makes
our XSS filter more complicated. In general, we do not want to allow the
user to specify their own class attributes. So every class attribute
generated by the renderer becomes a special case for the filter. The
fewer of those, the better.
