mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 16:17:25 +02:00
fix: relative path markdown linking on versioned docs (#1281)
This commit is contained in:
parent
d78220a818
commit
63f014fce5
2 changed files with 13 additions and 1 deletions
|
@ -73,8 +73,11 @@ function mdToHtmlify(oldContent, mdToHtml, metadata) {
|
|||
let mdMatch = mdRegex.exec(modifiedLine);
|
||||
while (mdMatch !== null) {
|
||||
/* Replace it to correct html link */
|
||||
const docsSource = metadata.version
|
||||
? metadata.source.replace(/version-.*?\//, '')
|
||||
: metadata.source;
|
||||
let htmlLink =
|
||||
mdToHtml[resolve(metadata.source, mdMatch[1])] || mdToHtml[mdMatch[1]];
|
||||
mdToHtml[resolve(docsSource, mdMatch[1])] || mdToHtml[mdMatch[1]];
|
||||
if (htmlLink) {
|
||||
htmlLink = getPath(htmlLink, siteConfig.cleanUrl);
|
||||
htmlLink = htmlLink.replace('/en/', `/${metadata.language}/`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue