mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 00:09:48 +02:00
fix: replace apostrophe with empty string in header slugification (#1618)
* Replace apostrophe with empty string in header This change is to replicate the github behviour with respect to apostrophe in headers. When there is an apostrophe in a header, github replaces it with empty string when creating an anchor link to that header. Docusaurus should follow the same convention.
This commit is contained in:
parent
9e84525bcf
commit
db44eccac3
2 changed files with 4 additions and 2 deletions
|
@ -45,8 +45,8 @@ module.exports = (string, context = {}) => {
|
|||
.replace(new RegExp(`[${accents}]`, 'g'), c =>
|
||||
without.charAt(accents.indexOf(c)),
|
||||
)
|
||||
// Replace `.`, `(` and `?` with blank string like Github does
|
||||
.replace(/\.|\(|\?/g, '')
|
||||
// Replace `'`, `’`, `.`, `(` and `?` with blank string like GitHub does
|
||||
.replace(/'|’|\.|\(|\?/g, '')
|
||||
// Dash special characters except '_' (underscore)
|
||||
.replace(exceptAlphanumAndUnderscore, '-')
|
||||
// Compress multiple dash
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue