mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-14 17:47:40 +02:00
refactor: simplify blog url replacement regex (#1491)
This commit is contained in:
parent
cbd2a589e3
commit
9a18b7430a
1 changed files with 1 additions and 4 deletions
|
@ -19,10 +19,7 @@ function urlToSource(url) {
|
|||
if (!url || typeof url !== 'string') {
|
||||
return null;
|
||||
}
|
||||
return url
|
||||
.replace(/\/index.html$/, '.md')
|
||||
.replace(/\.html$/, '.md')
|
||||
.replace(new RegExp('/', 'g'), '-');
|
||||
return url.replace(/(\/index)?\.html$/, '.md').replace(/\//g, '-');
|
||||
}
|
||||
|
||||
function fileToUrl(file) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue