mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Trim code snippet comments.
This commit is contained in:
@@ -135,12 +135,15 @@ function tidyHighlights($) {
|
||||
const attr = _.intersection(classes, highlights[ext]).join(' ');
|
||||
$element.attr('class', attr || null);
|
||||
});
|
||||
// Collapse nested highlights.
|
||||
_.each(['comment', 'string'], cls => {
|
||||
$parent.find(`[class~="${ cls }"]`).each(function() {
|
||||
const $element = $(this);
|
||||
$element.text($element.text());
|
||||
});
|
||||
// Collapse nested comment highlights.
|
||||
$parent.find(`[class~="comment"]`).each(function() {
|
||||
const $element = $(this);
|
||||
$element.text($element.text().trim());
|
||||
});
|
||||
// Collapse nested string highlights.
|
||||
$parent.find(`[class~="string"]`).each(function() {
|
||||
const $element = $(this);
|
||||
$element.text($element.text());
|
||||
});
|
||||
// Collapse nested spans.
|
||||
while (($spans = $parent.find('span:not([class])')).length) {
|
||||
@@ -172,7 +175,7 @@ function build() {
|
||||
|
||||
const $ = marky(markdown, { 'sanitize': false });
|
||||
const $header = $('h1').first().remove();
|
||||
const version = _.trim($header.find('span').first().text()).slice(1);
|
||||
const version = $header.find('span').first().text().trim().slice(1);
|
||||
|
||||
// Auto-link Lodash method references.
|
||||
autoLink($);
|
||||
@@ -198,7 +201,7 @@ function build() {
|
||||
'',
|
||||
// Wrap in raw tags to avoid Liquid template tag processing.
|
||||
'{% raw %}',
|
||||
_.trim($.html()),
|
||||
$.html().trim(),
|
||||
'{% endraw %}',
|
||||
''
|
||||
].join('\n');
|
||||
|
||||
Reference in New Issue
Block a user