upstream #1
@ -1,4 +1,4 @@
|
|||||||
import { escape } from 'html-escaper'
|
import { escape } from '@/lib/utils/htmlEscaper'
|
||||||
|
|
||||||
import siteMetadata from '@/data/siteMetadata'
|
import siteMetadata from '@/data/siteMetadata'
|
||||||
|
|
||||||
|
23
lib/utils/htmlEscaper.js
Normal file
23
lib/utils/htmlEscaper.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
const { replace } = ''
|
||||||
|
|
||||||
|
// escape
|
||||||
|
const es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g
|
||||||
|
const ca = /[&<>'"]/g
|
||||||
|
|
||||||
|
const esca = {
|
||||||
|
'&': '&',
|
||||||
|
'<': '<',
|
||||||
|
'>': '>',
|
||||||
|
"'": ''',
|
||||||
|
'"': '"',
|
||||||
|
}
|
||||||
|
const pe = (m) => esca[m]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`.
|
||||||
|
* @param {string} es the input to safely escape
|
||||||
|
* @returns {string} the escaped input, and it **throws** an error if
|
||||||
|
* the input type is unexpected, except for boolean and numbers,
|
||||||
|
* converted as string.
|
||||||
|
*/
|
||||||
|
export const escape = (es) => replace.call(es, ca, pe)
|
11
package-lock.json
generated
11
package-lock.json
generated
@ -12,7 +12,6 @@
|
|||||||
"@tailwindcss/typography": "^0.4.0",
|
"@tailwindcss/typography": "^0.4.0",
|
||||||
"autoprefixer": "^10.2.5",
|
"autoprefixer": "^10.2.5",
|
||||||
"gray-matter": "^4.0.2",
|
"gray-matter": "^4.0.2",
|
||||||
"html-escaper": "^3.0.3",
|
|
||||||
"image-size": "1.0.0",
|
"image-size": "1.0.0",
|
||||||
"next": "10.2.3",
|
"next": "10.2.3",
|
||||||
"next-mdx-remote": "^3.0.1",
|
"next-mdx-remote": "^3.0.1",
|
||||||
@ -5274,11 +5273,6 @@
|
|||||||
"minimalistic-crypto-utils": "^1.0.1"
|
"minimalistic-crypto-utils": "^1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/html-escaper": {
|
|
||||||
"version": "3.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",
|
|
||||||
"integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ=="
|
|
||||||
},
|
|
||||||
"node_modules/html-tags": {
|
"node_modules/html-tags": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.1.0.tgz",
|
||||||
@ -14648,11 +14642,6 @@
|
|||||||
"minimalistic-crypto-utils": "^1.0.1"
|
"minimalistic-crypto-utils": "^1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"html-escaper": {
|
|
||||||
"version": "3.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",
|
|
||||||
"integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ=="
|
|
||||||
},
|
|
||||||
"html-tags": {
|
"html-tags": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.1.0.tgz",
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
"@tailwindcss/typography": "^0.4.0",
|
"@tailwindcss/typography": "^0.4.0",
|
||||||
"autoprefixer": "^10.2.5",
|
"autoprefixer": "^10.2.5",
|
||||||
"gray-matter": "^4.0.2",
|
"gray-matter": "^4.0.2",
|
||||||
"html-escaper": "^3.0.3",
|
|
||||||
"image-size": "1.0.0",
|
"image-size": "1.0.0",
|
||||||
"next": "10.2.3",
|
"next": "10.2.3",
|
||||||
"next-mdx-remote": "^3.0.1",
|
"next-mdx-remote": "^3.0.1",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user