mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
BUGFIX: Make sure hash links aren't treated as relative (#226)
This commit is contained in:
parent
c9d3bfd92e
commit
5b98902937
4
.gitignore
vendored
4
.gitignore
vendored
@ -70,4 +70,6 @@ yarn-error.log
|
||||
.yarn-integrity
|
||||
|
||||
static/_redirects
|
||||
public/_redirects
|
||||
public/_redirects
|
||||
|
||||
.vscode
|
||||
|
18
.vscode/settings.json
vendored
18
.vscode/settings.json
vendored
@ -1,18 +0,0 @@
|
||||
{
|
||||
"workbench.colorCustomizations": {
|
||||
"activityBar.background": "#88d7ea",
|
||||
"activityBar.activeBorder": "#de41bf",
|
||||
"activityBar.foreground": "#15202b",
|
||||
"activityBar.inactiveForeground": "#15202b99",
|
||||
"activityBarBadge.background": "#de41bf",
|
||||
"activityBarBadge.foreground": "#e7e7e7",
|
||||
"titleBar.activeBackground": "#5dc9e2",
|
||||
"titleBar.inactiveBackground": "#5dc9e299",
|
||||
"titleBar.activeForeground": "#15202b",
|
||||
"titleBar.inactiveForeground": "#15202b99",
|
||||
"statusBar.background": "#5dc9e2",
|
||||
"statusBarItem.hoverBackground": "#32bbda",
|
||||
"statusBar.foreground": "#15202b"
|
||||
},
|
||||
"peacock.color": "#5dc9e2"
|
||||
}
|
@ -40,6 +40,19 @@ const rewriteLink = (
|
||||
|
||||
const currentNode = getCurrentNode();
|
||||
const version = getCurrentVersion();
|
||||
|
||||
// hash links
|
||||
if (href.startsWith('#')) {
|
||||
return createElement(
|
||||
Link,
|
||||
{
|
||||
to: path.join(currentNode?.slug, href),
|
||||
className: 'gatsby-link'
|
||||
},
|
||||
domToReact(children, parseOptions)
|
||||
);
|
||||
}
|
||||
|
||||
// shorthand api links
|
||||
if (href.match(/^api\:/)) {
|
||||
const newHref = rewriteAPILink(href);
|
||||
|
Loading…
x
Reference in New Issue
Block a user