Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
➕ use slug package to make anchor more idiom and emoji compatible
Signed-off-by: Vinicius Reis <[email protected]>
  • Loading branch information
Vinicius Reis authored and mejo- committed Oct 5, 2022
commit af03b69df067ef2dedb3ece1d93c8759500dce34
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'