Skip to content

Commit

Permalink
➕ use slug package to make anchor more idiom and emoji compatible
Browse files Browse the repository at this point in the history
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
  • Loading branch information
Vinicius Reis committed Oct 3, 2022
1 parent 2334b1d commit de64f25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
11 changes: 11 additions & 0 deletions package-lock.json

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

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"prosemirror-utils": "^1.0.0-0",
"prosemirror-view": "^1.28.0",
"proxy-polyfill": "^0.3.2",
"slug": "^8.0.0",
"tippy.js": "^6.3.7",
"uuid": "^9.0.0",
"vue": "^2.7.10",
Expand Down Expand Up @@ -145,7 +146,7 @@
],
"moduleNameMapper": {
"^@/(.*)$": "<rootDir>/src/$1",
"\\.(css)$": "identity-obj-proxy"
"\\.(css)$": "identity-obj-proxy"
},
"testPathIgnorePatterns": [
"<rootDir>/src/tests/fixtures/",
Expand All @@ -163,8 +164,6 @@
"setupFilesAfterEnv": [
"<rootDir>/src/tests/setup.js"
],
"transformIgnorePatterns": [

]
"transformIgnorePatterns": []
}
}
11 changes: 1 addition & 10 deletions src/nodes/Heading/slug.js
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
const regexSpaces = /\s+/g
const regexInvalidCaracters = /[^\p{Letter}\p{Mark}\w\s-]/gu

const slugify = (str) => String(str)
.toLowerCase()
.replace(regexInvalidCaracters, '')
.trim()
.replace(regexSpaces, '-')

export { slugify }
export { default as slugify } from 'slug'

0 comments on commit de64f25

Please sign in to comment.