diff --git a/lib/app/views/partials/section.html b/lib/app/views/partials/section.html index 908d19d1..1689530a 100644 --- a/lib/app/views/partials/section.html +++ b/lib/app/views/partials/section.html @@ -5,7 +5,7 @@
/, ''); + desc = desc.replace(/<\/p>\n$/, ''); + } - var sanitized = sanitizeHtml(string, {allowedTags: [], allowedAttributes: []}); // HACK: Remove extra parameters from descriotion - sanitized = sanitized.split(/sg\-[^:]*:/)[0]; - return sanitized; + desc = desc.split(/sg\-[^:]*:/)[0]; + return desc; } function processBlock(block, options) { diff --git a/package.json b/package.json index 805617aa..60558250 100644 --- a/package.json +++ b/package.json @@ -45,12 +45,12 @@ "gulp-util": "~3.0.4", "kss": "~2.0.2", "lodash": "~3.5.0", + "marked": "^0.3.3", "minimatch": "~2.0.4", "morgan": "~1.5.2", "node-neat": "~1.7.1-beta1", "q": "~1.2.0", "run-sequence": "~1.0.2", - "sanitize-html": "~1.6.1", "socket.io": "~1.3.5", "through2": "~0.6.3", "vinyl": "~0.4.6", diff --git a/test/unit/modules/kss-parser.test.js b/test/unit/modules/kss-parser.test.js index 0e0c1d28..de610ebb 100644 --- a/test/unit/modules/kss-parser.test.js +++ b/test/unit/modules/kss-parser.test.js @@ -67,6 +67,70 @@ describe('KSS parser', function() { }).then(done).catch(done); }); + it('should parse markdown in header correctly', function(done) { + var files = { + 'file.less': multiline(function() { + /* + // This should be __strong__. + // + // Styleguide 1.0 + */ + }) + }; + parse(files).then(function(sections) { + expect(sections[0].header).to.eql('This should be strong.'); + }).then(done).catch(done); + }); + + it('should allow HTML in header', function(done) { + var files = { + 'file.less': multiline(function() { + /* + // This should be strong. + // + // Styleguide 1.0 + */ + }) + }; + parse(files).then(function(sections) { + expect(sections[0].header).to.eql('This should be strong.'); + }).then(done).catch(done); + }); + + it('should parse markdown in description correctly', function(done) { + var files = { + 'file.less': multiline(function() { + /* + // Header + // + // This should be __strong__. + // + // Styleguide 1.0 + */ + }) + }; + parse(files).then(function(sections) { + expect(sections[0].description).to.eql('
This should be strong.
\n'); + }).then(done).catch(done); + }); + + it('should allow HTML in description', function(done) { + var files = { + 'file.less': multiline(function() { + /* + // Header + // + // This should be strong. + // + // Styleguide 1.0 + */ + }) + }; + parse(files).then(function(sections) { + expect(sections[0].description).to.eql('This should be strong.
\n'); + }).then(done).catch(done); + }); + it('sorts sections numerically according to first level', function(done) { var file = {'file1.less': multiline(function() { /*