fix(markup): strip tags from description meta tag

This commit is contained in:
Rafael Bardini 2021-02-14 15:46:32 +01:00
parent d30dd196f0
commit 17d01bb598
4 changed files with 18 additions and 3 deletions

View File

@ -2,6 +2,7 @@ const fs = require('fs')
const path = require('path') const path = require('path')
const Handlebars = require('handlebars') const Handlebars = require('handlebars')
const micromark = require('micromark') const micromark = require('micromark')
const striptags = require('striptags')
const extname = '.hbs' const extname = '.hbs'
const partialsDir = path.join(__dirname, 'partials') const partialsDir = path.join(__dirname, 'partials')
@ -33,6 +34,8 @@ Handlebars.registerHelper('join', (arr, separator) =>
Handlebars.registerHelper('markdown', doc => micromark(doc)) Handlebars.registerHelper('markdown', doc => micromark(doc))
Handlebars.registerHelper('stripTags', html => striptags(html))
exports.pdfRenderOptions = { mediaType: 'print' } exports.pdfRenderOptions = { mediaType: 'print' }
exports.render = resume => { exports.render = resume => {

13
package-lock.json generated
View File

@ -10,7 +10,8 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"handlebars": "^4.7.6", "handlebars": "^4.7.6",
"micromark": "^2.11.4" "micromark": "^2.11.4",
"striptags": "^3.1.1"
}, },
"devDependencies": { "devDependencies": {
"eslint": "7.20.0", "eslint": "7.20.0",
@ -4611,6 +4612,11 @@
"url": "https://github.com/sponsors/sindresorhus" "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": { "node_modules/supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@ -10981,6 +10987,11 @@
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
"dev": true "dev": true
}, },
"striptags": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/striptags/-/striptags-3.1.1.tgz",
"integrity": "sha1-yMPn/db7S7OjKjt1LltePjgJPr0="
},
"supports-color": { "supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",

View File

@ -29,7 +29,8 @@
}, },
"dependencies": { "dependencies": {
"handlebars": "^4.7.6", "handlebars": "^4.7.6",
"micromark": "^2.11.4" "micromark": "^2.11.4",
"striptags": "^3.1.1"
}, },
"devDependencies": { "devDependencies": {
"eslint": "7.20.0", "eslint": "7.20.0",

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>{{resume.basics.name}}</title> <title>{{resume.basics.name}}</title>
<meta name="description" content="{{resume.basics.summary}}"> <meta name="description" content="{{stripTags (markdown resume.basics.summary)}}">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700&display=swap"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700&display=swap">
<style>{{{css}}}</style> <style>{{{css}}}</style>