diff --git a/index.js b/index.js index 98b56ea..b565ac7 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,6 @@ const fs = require('fs') const path = require('path') +const { icons } = require('feather-icons') const Handlebars = require('handlebars') const micromark = require('micromark') const striptags = require('striptags') @@ -38,6 +39,10 @@ Handlebars.registerHelper('formatURL', url => url.replace(/^(https?:|)\/\//, '').replace(/\/$/, ''), ) +Handlebars.registerHelper('icon', name => + icons[name].toSvg({ width: 16, height: 16 }), +) + Handlebars.registerHelper('join', (arr, separator) => arr.join(typeof separator === 'string' ? separator : ', '), ) diff --git a/package-lock.json b/package-lock.json index fdaac3a..261e1e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "hasInstallScript": true, "license": "MIT", "dependencies": { - "handlebars": "4.7.0", + "feather-icons": "^4.28.0", + "handlebars": "^4.7.0", "micromark": "^2.11.0", "striptags": "^3.1.0" }, @@ -735,6 +736,11 @@ "fsevents": "~2.3.1" } }, + "node_modules/classnames": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz", + "integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==" + }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -973,6 +979,16 @@ "safe-buffer": "~5.1.1" } }, + "node_modules/core-js": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.9.1.tgz", + "integrity": "sha512-gSjRvzkxQc1zjM/5paAmL4idJBFzuJoo+jDjF1tStYFMV2ERfD02HhahhCGXUyHxQRG4yFKVSdO6g62eoRMcDg==", + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -1238,9 +1254,9 @@ } }, "node_modules/es-abstract": { - "version": "1.18.0-next.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.3.tgz", - "integrity": "sha512-VMzHx/Bczjg59E6jZOQjHeN3DEoptdhejpARgflAViidlqSpjdq9zA6lKwlhRRs/lOw1gHJv2xkkSFRgvEwbQg==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", + "integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==", "dev": true, "dependencies": { "call-bind": "^1.0.2", @@ -1585,6 +1601,15 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "node_modules/feather-icons": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/feather-icons/-/feather-icons-4.28.0.tgz", + "integrity": "sha512-gRdqKESXRBUZn6Nl0VBq2wPHKRJgZz7yblrrc2lYsS6odkNFDnA4bqvrlEVRUPjE1tFax+0TdbJKZ31ziJuzjg==", + "dependencies": { + "classnames": "^2.2.5", + "core-js": "^3.1.3" + } + }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -1676,21 +1701,21 @@ "dev": true }, "node_modules/flow-parser": { - "version": "0.145.0", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.145.0.tgz", - "integrity": "sha512-dqpYiE0rZopmex5FR6pi/HTia8i+q/euc9WUWH6fTLt6sQgXjnAcsOwgMMLHCxwCSqPrvi/XFmBiicKitLNrKA==", + "version": "0.146.0", + "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.146.0.tgz", + "integrity": "sha512-lMaDIdcEsdtKL0B+VFp8et/AjnB+cU1HJ6KDrp4Lw3Gsq0Ck0cmWRDgWfUQxxDvY99ntQyA/IdyFxFK4izKo4g==", "dev": true, "engines": { "node": ">=0.4.0" } }, "node_modules/flow-remove-types": { - "version": "2.145.0", - "resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-2.145.0.tgz", - "integrity": "sha512-P80u1yzJsiFu15+poHqoYbU/rcEqUcaI3NcR6kmPyAjgcrhPlxLi3/73tfg3C5FFl9+JR7+Xkv/PQYgg4yyCoQ==", + "version": "2.146.0", + "resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-2.146.0.tgz", + "integrity": "sha512-/ltZxsbllKEzaWAKEe0NsO5h+82NsXQ7ep8frpksbIgRQDzUBBOlLA4KhN/sjZIPkHP2xSO3MeltdzrWEm2JPg==", "dev": true, "dependencies": { - "flow-parser": "^0.145.0", + "flow-parser": "^0.146.0", "pirates": "^3.0.2", "vlq": "^0.2.1" }, @@ -1956,13 +1981,14 @@ "dev": true }, "node_modules/handlebars": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.0.tgz", - "integrity": "sha512-PaZ6G6nYzfJ0Hd1WIhOpsnUPWh1R0Pg//r4wEYOtzG65c2V8RJQ/++yYlVmuoQ7EMXcb4eri5+FB2XH1Lwed9g==", + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", "dependencies": { + "minimist": "^1.2.5", "neo-async": "^2.6.0", - "optimist": "^0.6.1", - "source-map": "^0.6.1" + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" }, "bin": { "handlebars": "bin/handlebars" @@ -2992,9 +3018,9 @@ } }, "node_modules/listr2": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.3.4.tgz", - "integrity": "sha512-b0lhLAvXSr63AtPF9Dgn6tyxm8Kiz6JXpVGM0uZJdnDcZp02jt7FehgAnMfA9R7riQimOKjQgLknBTdz2nmXwQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.4.0.tgz", + "integrity": "sha512-/f7QLS/K9fix4C/JdNe+2nZ+cuc0dNdJx30csfylHYh7veyayeswDkDUiywnGtzHxegnL0H9qqLvhb5ve9zzow==", "dev": true, "dependencies": { "chalk": "^4.1.0", @@ -3302,8 +3328,7 @@ "node_modules/minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "node_modules/minipass": { "version": "3.1.3", @@ -3571,20 +3596,6 @@ "opener": "bin/opener-bin.js" } }, - "node_modules/optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dependencies": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - } - }, - "node_modules/optimist/node_modules/minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" - }, "node_modules/optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -6954,12 +6965,9 @@ } }, "node_modules/wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "engines": { - "node": ">=0.4.0" - } + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" }, "node_modules/wrap-ansi": { "version": "7.0.0", @@ -7771,6 +7779,11 @@ "readdirp": "~3.5.0" } }, + "classnames": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz", + "integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==" + }, "clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -7956,6 +7969,11 @@ "safe-buffer": "~5.1.1" } }, + "core-js": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.9.1.tgz", + "integrity": "sha512-gSjRvzkxQc1zjM/5paAmL4idJBFzuJoo+jDjF1tStYFMV2ERfD02HhahhCGXUyHxQRG4yFKVSdO6g62eoRMcDg==" + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -8165,9 +8183,9 @@ } }, "es-abstract": { - "version": "1.18.0-next.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.3.tgz", - "integrity": "sha512-VMzHx/Bczjg59E6jZOQjHeN3DEoptdhejpARgflAViidlqSpjdq9zA6lKwlhRRs/lOw1gHJv2xkkSFRgvEwbQg==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", + "integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==", "dev": true, "requires": { "call-bind": "^1.0.2", @@ -8435,6 +8453,15 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "feather-icons": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/feather-icons/-/feather-icons-4.28.0.tgz", + "integrity": "sha512-gRdqKESXRBUZn6Nl0VBq2wPHKRJgZz7yblrrc2lYsS6odkNFDnA4bqvrlEVRUPjE1tFax+0TdbJKZ31ziJuzjg==", + "requires": { + "classnames": "^2.2.5", + "core-js": "^3.1.3" + } + }, "figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -8505,18 +8532,18 @@ "dev": true }, "flow-parser": { - "version": "0.145.0", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.145.0.tgz", - "integrity": "sha512-dqpYiE0rZopmex5FR6pi/HTia8i+q/euc9WUWH6fTLt6sQgXjnAcsOwgMMLHCxwCSqPrvi/XFmBiicKitLNrKA==", + "version": "0.146.0", + "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.146.0.tgz", + "integrity": "sha512-lMaDIdcEsdtKL0B+VFp8et/AjnB+cU1HJ6KDrp4Lw3Gsq0Ck0cmWRDgWfUQxxDvY99ntQyA/IdyFxFK4izKo4g==", "dev": true }, "flow-remove-types": { - "version": "2.145.0", - "resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-2.145.0.tgz", - "integrity": "sha512-P80u1yzJsiFu15+poHqoYbU/rcEqUcaI3NcR6kmPyAjgcrhPlxLi3/73tfg3C5FFl9+JR7+Xkv/PQYgg4yyCoQ==", + "version": "2.146.0", + "resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-2.146.0.tgz", + "integrity": "sha512-/ltZxsbllKEzaWAKEe0NsO5h+82NsXQ7ep8frpksbIgRQDzUBBOlLA4KhN/sjZIPkHP2xSO3MeltdzrWEm2JPg==", "dev": true, "requires": { - "flow-parser": "^0.145.0", + "flow-parser": "^0.146.0", "pirates": "^3.0.2", "vlq": "^0.2.1" } @@ -8720,14 +8747,15 @@ "dev": true }, "handlebars": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.0.tgz", - "integrity": "sha512-PaZ6G6nYzfJ0Hd1WIhOpsnUPWh1R0Pg//r4wEYOtzG65c2V8RJQ/++yYlVmuoQ7EMXcb4eri5+FB2XH1Lwed9g==", + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", "requires": { + "minimist": "^1.2.5", "neo-async": "^2.6.0", - "optimist": "^0.6.1", "source-map": "^0.6.1", - "uglify-js": "^3.1.4" + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" } }, "har-schema": { @@ -9476,9 +9504,9 @@ } }, "listr2": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.3.4.tgz", - "integrity": "sha512-b0lhLAvXSr63AtPF9Dgn6tyxm8Kiz6JXpVGM0uZJdnDcZp02jt7FehgAnMfA9R7riQimOKjQgLknBTdz2nmXwQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.4.0.tgz", + "integrity": "sha512-/f7QLS/K9fix4C/JdNe+2nZ+cuc0dNdJx30csfylHYh7veyayeswDkDUiywnGtzHxegnL0H9qqLvhb5ve9zzow==", "dev": true, "requires": { "chalk": "^4.1.0", @@ -9716,8 +9744,7 @@ "minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "minipass": { "version": "3.1.3", @@ -9926,22 +9953,6 @@ "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", "dev": true }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - }, - "dependencies": { - "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" - } - } - }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -12517,9 +12528,9 @@ "dev": true }, "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" }, "wrap-ansi": { "version": "7.0.0", diff --git a/package.json b/package.json index 62baefb..6f75496 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "test": "tap" }, "dependencies": { - "handlebars": "4.7.0", + "feather-icons": "^4.28.0", + "handlebars": "^4.7.0", "micromark": "^2.11.0", "striptags": "^3.1.0" }, diff --git a/partials/header.hbs b/partials/header.hbs index 2514ed2..08178d3 100644 --- a/partials/header.hbs +++ b/partials/header.hbs @@ -11,32 +11,32 @@ {{#location}} {{#if city}}
  • - + {{{icon 'map-pin'}}} {{city}}{{#countryCode}}, {{formatCountry .}}{{/countryCode}}
  • {{/if}} {{/location}} {{#email}}
  • - + {{{icon 'mail'}}} {{.}}
  • {{/email}} {{#phone}}
  • - + {{{icon 'phone'}}} {{.}}
  • {{/phone}} {{#url}}
  • - + {{{icon 'link'}}} {{formatURL .}}
  • {{/url}} {{#profiles}}
  • - + {{{icon 'user'}}} {{#if username}} {{#if url}} {{username}} diff --git a/style.css b/style.css index 93a71f1..96498c9 100644 --- a/style.css +++ b/style.css @@ -132,12 +132,7 @@ cite::before { } svg { - fill: none; margin-right: 0.2em; - stroke: currentColor; - stroke-linecap: round; - stroke-linejoin: round; - stroke-width: 2; vertical-align: -0.2em; } diff --git a/tap-snapshots/test-render.js-TAP.test.js b/tap-snapshots/test-render.js-TAP.test.js index 9036a65..aac03a0 100644 --- a/tap-snapshots/test-render.js-TAP.test.js +++ b/tap-snapshots/test-render.js-TAP.test.js @@ -148,12 +148,7 @@ cite::before { } svg { - fill: none; margin-right: 0.2em; - stroke: currentColor; - stroke-linecap: round; - stroke-linejoin: round; - stroke-width: 2; vertical-align: -0.2em; } @@ -251,28 +246,28 @@ blockquote > * + * {