mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-01 19:27:48 +02:00
Fix replacement of relative doc links
This commit is contained in:
parent
c0c75e16f4
commit
cfc6030d23
2 changed files with 16 additions and 1 deletions
|
@ -163,7 +163,16 @@ function execute() {
|
|||
? "/" + metadata.version + "/"
|
||||
: "/"
|
||||
);
|
||||
rawContent = rawContent.replace(new RegExp(key, "g"), link);
|
||||
// replace relative links without "./"
|
||||
rawContent = rawContent.replace(
|
||||
new RegExp("\\]\\(" + key, "g"),
|
||||
"](" + link
|
||||
);
|
||||
// replace relative links with "./"
|
||||
rawContent = rawContent.replace(
|
||||
new RegExp("\\]\\(\\./" + key, "g"),
|
||||
"](" + link
|
||||
);
|
||||
});
|
||||
|
||||
// replace any relative links to static assets to absolute links
|
||||
|
|
|
@ -190,10 +190,16 @@ function execute(port) {
|
|||
? "/" + metadata.version + "/"
|
||||
: "/"
|
||||
);
|
||||
// replace relative links without "./"
|
||||
rawContent = rawContent.replace(
|
||||
new RegExp("\\]\\(" + key, "g"),
|
||||
"](" + link
|
||||
);
|
||||
// replace relative links with "./"
|
||||
rawContent = rawContent.replace(
|
||||
new RegExp("\\]\\(\\./" + key, "g"),
|
||||
"](" + link
|
||||
);
|
||||
});
|
||||
|
||||
// replace any relative links to static assets to absolute links
|
||||
|
|
Loading…
Add table
Reference in a new issue