From 1aec3449e079a840532a047450dadef412d8a8e4 Mon Sep 17 00:00:00 2001 From: Nick Cox Date: Mon, 30 Mar 2015 22:30:36 -0700 Subject: [PATCH] Add String method to strip
tags from markdown, call in doc compilation --- tasks/compile-docs.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tasks/compile-docs.js b/tasks/compile-docs.js index 2c3d043645..078aa4e56b 100644 --- a/tasks/compile-docs.js +++ b/tasks/compile-docs.js @@ -87,7 +87,7 @@ _.extend(Compiler.prototype, { // Attempts to replace extension of content links to other documents compiledContents = compiledContents.replace(/.md/g, '.html'); - return compiledContents; + return compiledContents.stripBrTags(); }, getPageTitle: function(compiledContents) { @@ -109,8 +109,7 @@ _.extend(Compiler.prototype, { var description = compiledContents.match(/

([\s\S]*?)<\/p>/)[1]; return description - // force translation of breaks to a space - .replace(/
/g, ' ') + .stripBrTags() // remove remaining tags .replace(/\<[^\>]*\>/g, ''); // } @@ -326,3 +325,6 @@ module.exports = function(grunt) { .then(this.async()); }); }; + +String.prototype.stripBrTags = function() { return this.replace(/
/g, ' '); } +