Skip to content

Commit

Permalink
refactor: replace github-slugger with lodash.kebabcase (#357)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alejandronanez authored Aug 19, 2024
1 parent 65b6a49 commit 2b617b2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
23 changes: 22 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/slugify.ts
Original file line number Diff line number Diff line change
@@ -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));

0 comments on commit 2b617b2

Please sign in to comment.