Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs UI update #3

Merged
merged 12 commits into from
Aug 1, 2024
4 changes: 2 additions & 2 deletions src/utils/contentApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export default class ContentApi {

// we remove any special characters from the end of the label
// to make it look cleaner in the UI
label = label.replace(/[^a-zA-Z0-9]+$/, "");
label = label.replace(/[^\p{L}\p{N}]+$/u, "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW @ZYJLiu you can use \p{Letter} and \p{Number} to make the unicode bits more obvious. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape


// if (!duplicator.has(label)) {
// duplicator.set(label, 0);
Expand Down Expand Up @@ -388,7 +388,7 @@ export default class ContentApi {
.trim()
.replace(/\s+/g, "-")
.replace(/\./g, "")
.replace(/[^a-z0-9]+/g, "-")
.replace(/[^\p{L}\p{N}]+/gu, "-")
.replace(/^-/g, "")
.replace(/-$/g, "")
.replace(/--+/g, "-");
Expand Down
Loading