mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
refactor: replace github-slugger with lodash.kebabcase (#357)
Previously, `github-slugger` omitted emojis when generating slugs, transforming tags like "🌱-my-tag" into "-my-tag". This change replaces `github-slugger` with `lodash.kebabcase` to ensure that emojis are preserved in the generated slugs, improving the accuracy and consistency of tag representations.
This commit is contained in:
committed by
GitHub
parent
65b6a492c3
commit
2b617b20a3
Generated
+22
-1
@@ -13,7 +13,7 @@
|
||||
"@resvg/resvg-js": "^2.6.2",
|
||||
"astro": "^4.13.0",
|
||||
"fuse.js": "^7.0.0",
|
||||
"github-slugger": "^2.0.0",
|
||||
"lodash.kebabcase": "^4.1.1",
|
||||
"remark-collapse": "^0.1.2",
|
||||
"remark-toc": "^9.0.0",
|
||||
"satori": "^0.10.14",
|
||||
@@ -26,6 +26,7 @@
|
||||
"@astrojs/tailwind": "^5.1.0",
|
||||
"@tailwindcss/typography": "^0.5.13",
|
||||
"@types/github-slugger": "^1.3.0",
|
||||
"@types/lodash.kebabcase": "^4.1.9",
|
||||
"@types/react": "^18.3.3",
|
||||
"@typescript-eslint/parser": "^6.19.0",
|
||||
"astro-eslint-parser": "^0.16.2",
|
||||
@@ -2053,6 +2054,21 @@
|
||||
"@types/unist": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/lodash": {
|
||||
"version": "4.17.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz",
|
||||
"integrity": "sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/lodash.kebabcase": {
|
||||
"version": "4.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash.kebabcase/-/lodash.kebabcase-4.1.9.tgz",
|
||||
"integrity": "sha512-kPrrmcVOhSsjAVRovN0lRfrbuidfg0wYsrQa5IYuoQO1fpHHGSme66oyiYA/5eQPVl8Z95OA3HG0+d2SvYC85w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/lodash": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/mdast": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.3.tgz",
|
||||
@@ -5806,6 +5822,11 @@
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/lodash.kebabcase": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz",
|
||||
"integrity": "sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g=="
|
||||
},
|
||||
"node_modules/lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
|
||||
+2
-1
@@ -19,7 +19,7 @@
|
||||
"@resvg/resvg-js": "^2.6.2",
|
||||
"astro": "^4.13.0",
|
||||
"fuse.js": "^7.0.0",
|
||||
"github-slugger": "^2.0.0",
|
||||
"lodash.kebabcase": "^4.1.1",
|
||||
"remark-collapse": "^0.1.2",
|
||||
"remark-toc": "^9.0.0",
|
||||
"satori": "^0.10.14",
|
||||
@@ -32,6 +32,7 @@
|
||||
"@astrojs/tailwind": "^5.1.0",
|
||||
"@tailwindcss/typography": "^0.5.13",
|
||||
"@types/github-slugger": "^1.3.0",
|
||||
"@types/lodash.kebabcase": "^4.1.9",
|
||||
"@types/react": "^18.3.3",
|
||||
"@typescript-eslint/parser": "^6.19.0",
|
||||
"astro-eslint-parser": "^0.16.2",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { slug as slugger } from "github-slugger";
|
||||
import kebabcase from "lodash.kebabcase";
|
||||
|
||||
export const slugifyStr = (str: string) => slugger(str);
|
||||
export const slugifyStr = (str: string) => kebabcase(str);
|
||||
|
||||
export const slugifyAll = (arr: string[]) => arr.map(str => slugifyStr(str));
|
||||
|
||||
Reference in New Issue
Block a user