mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Reduce highlights class names.
This commit is contained in:
@@ -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.
|
||||
'---',
|
||||
|
||||
Reference in New Issue
Block a user