From 17d01bb598bb5582b7fd02190c2333c789532d50 Mon Sep 17 00:00:00 2001 From: Rafael Bardini Date: Sun, 14 Feb 2021 15:46:32 +0100 Subject: [PATCH] fix(markup): strip tags from description meta tag --- index.js | 3 +++ package-lock.json | 13 ++++++++++++- package.json | 3 ++- resume.hbs | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 15c6ef9..4132359 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ const fs = require('fs') const path = require('path') const Handlebars = require('handlebars') const micromark = require('micromark') +const striptags = require('striptags') const extname = '.hbs' const partialsDir = path.join(__dirname, 'partials') @@ -33,6 +34,8 @@ Handlebars.registerHelper('join', (arr, separator) => Handlebars.registerHelper('markdown', doc => micromark(doc)) +Handlebars.registerHelper('stripTags', html => striptags(html)) + exports.pdfRenderOptions = { mediaType: 'print' } exports.render = resume => { diff --git a/package-lock.json b/package-lock.json index 6e3a0ce..9ad64cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,8 @@ "license": "MIT", "dependencies": { "handlebars": "^4.7.6", - "micromark": "^2.11.4" + "micromark": "^2.11.4", + "striptags": "^3.1.1" }, "devDependencies": { "eslint": "7.20.0", @@ -4611,6 +4612,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/striptags": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/striptags/-/striptags-3.1.1.tgz", + "integrity": "sha1-yMPn/db7S7OjKjt1LltePjgJPr0=" + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -10981,6 +10987,11 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, + "striptags": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/striptags/-/striptags-3.1.1.tgz", + "integrity": "sha1-yMPn/db7S7OjKjt1LltePjgJPr0=" + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", diff --git a/package.json b/package.json index 68db500..6cf1072 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ }, "dependencies": { "handlebars": "^4.7.6", - "micromark": "^2.11.4" + "micromark": "^2.11.4", + "striptags": "^3.1.1" }, "devDependencies": { "eslint": "7.20.0", diff --git a/resume.hbs b/resume.hbs index 93239c3..1237cb8 100644 --- a/resume.hbs +++ b/resume.hbs @@ -3,7 +3,7 @@ {{resume.basics.name}} - +