diff --git a/extension.js b/extension.js index 096c9c2..e3b0a1f 100644 --- a/extension.js +++ b/extension.js @@ -4,6 +4,7 @@ const vscode = require('vscode'); const htmlEncode = require('js-htmlencode').htmlEncode; const removeMarkdown = require('remove-markdown'); const striptags = require('striptags'); +const emoji = require('node-emoji') const validHtmlClass = /^[a-z][a-z0-9_-]*$/i; @@ -56,5 +57,9 @@ function buildMarkerPatternOptionFromConfiguration(configuration) { } function sanitizeHeading(heading) { - return removeMarkdown(striptags(heading)); + return renderEmoji(removeMarkdown(striptags(heading))); +} + +function renderEmoji(heading) { + return emoji.emojify(heading, () => ''); } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 122c98d..6d8493a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1959,6 +1959,11 @@ "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", "dev": true }, + "lodash.toarray": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.toarray/-/lodash.toarray-4.4.0.tgz", + "integrity": "sha1-JMS/zWsvuji/0FlNsRedjptlZWE=" + }, "lru-cache": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", @@ -2190,6 +2195,14 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "node-emoji": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz", + "integrity": "sha512-Yt3384If5H6BYGVHiHwTL+99OzJKHhgp82S8/dktEK73T26BazdgZ4JZh92xSVtGNJvz9UbXdNAc5hcrXV42vw==", + "requires": { + "lodash.toarray": "^4.4.0" + } + }, "node.extend": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.1.8.tgz", diff --git a/package.json b/package.json index 6b84031..041af32 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "dependencies": { "js-htmlencode": "^0.3.0", "markdown-it-table-of-contents": "^0.4.3", + "node-emoji": "^1.10.0", "remove-markdown": "^0.3.0", "striptags": "^3.1.1" }