Reduce highlights class names.

This commit is contained in:
John-David Dalton
2016-08-21 23:01:41 -07:00
parent 2e4fc41c9b
commit 7ae0d0099d

View File

@@ -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.
'---',