From 107994859b3854f9aeb7fbe15c80de8fa12a9921 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 2 Jul 2016 13:41:28 -0700 Subject: [PATCH] Remove markymark links from h4s. --- lib/main/build-site.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/main/build-site.js b/lib/main/build-site.js index c4cf8ae8a..15b57a2b7 100644 --- a/lib/main/build-site.js +++ b/lib/main/build-site.js @@ -11,12 +11,21 @@ var basePath = path.join(__dirname, '..', '..'), readmePath = path.join(docPath, 'README.md'); function build(type) { - var html = marky(fs.readFileSync(readmePath, 'utf8'), { 'sanitize': false }), - header = html('h1').first(), - version = _.trim(header.find('span').first().text()); + var $ = marky(fs.readFileSync(readmePath, 'utf8'), { 'sanitize': false }), + $header = $('h1').first().remove(), + version = _.trim($header.find('span').first().text()); - header.remove(); - html = html.html().replace(/(<)!--\s*|\s*--(>)/g, '$1$2'); + $('h4').each(function() { + $(this) + .attr('class', null) + .attr('id', null) + .find('a').each(function() { + var $this = $(this); + $this.replaceWith($this.text()); + }); + }); + + var html = $.html().replace(/(<)!--\s*|\s*--(>)/g, '$1$2'); html = [ '---',