diff --git a/lib/main/build-site.js b/lib/main/build-site.js index 37c1ab045..eada119c6 100644 --- a/lib/main/build-site.js +++ b/lib/main/build-site.js @@ -21,6 +21,22 @@ function build(type) { $header = $('h1').first().remove(), version = _.trim($header.find('span').first().text()).slice(1); + var highlights = [ + 'comment', + 'constant', + 'delimiter', + 'html', + 'js', + 'method', + 'modifier', + 'numeric', + 'shell', + 'source', + 'string', + 'text', + 'type' + ]; + // Remove docdown horizontal rules. $('hr').remove(); @@ -51,6 +67,14 @@ function build(type) { $code.html($code.html().replace(/<\/?em>/g, '_')); }); + // Cleanup highlights class names. + $('.highlight [class]').each(function() { + var $el = $(this), + className = _.intersection($el.attr('class').split(/\s+/), highlights).join(' '); + + $el.attr('class', className || null); + }); + var html = [ // Append YAML front matter. '---',