diff --git a/lib/main/build-site.js b/lib/main/build-site.js index 6056289be..dc8819c55 100644 --- a/lib/main/build-site.js +++ b/lib/main/build-site.js @@ -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');