mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
more internal link tests
This commit is contained in:
parent
df085e3bfd
commit
6947ab48a2
@ -3,6 +3,8 @@ title: Ecosystem
|
|||||||
description: The Ocean Protocol network consists of various components.
|
description: The Ocean Protocol network consists of various components.
|
||||||
---
|
---
|
||||||
|
|
||||||
|
[Architecture](./architecture/)
|
||||||
|
|
||||||
Learn about all of them here.
|
Learn about all of them here.
|
||||||
|
|
||||||
- 💧 keeper. See also [Set Up a Keeper](/setup/keeper/)
|
- 💧 keeper. See also [Set Up a Keeper](/setup/keeper/)
|
||||||
|
@ -42,7 +42,8 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
'gatsby-remark-smartypants',
|
'gatsby-remark-smartypants',
|
||||||
'gatsby-remark-prismjs',
|
'gatsby-remark-prismjs',
|
||||||
'gatsby-remark-autolink-headers'
|
'gatsby-remark-autolink-headers',
|
||||||
|
'gatsby-remark-relative-linker'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -4,10 +4,10 @@ const { createFilePath } = require('gatsby-source-filesystem')
|
|||||||
exports.onCreateNode = ({ node, getNode, actions }) => {
|
exports.onCreateNode = ({ node, getNode, actions }) => {
|
||||||
const { createNodeField } = actions
|
const { createNodeField } = actions
|
||||||
|
|
||||||
if (node.internal.type === `MarkdownRemark`) {
|
if (node.internal.type === 'MarkdownRemark') {
|
||||||
const fileNode = getNode(node.parent)
|
const fileNode = getNode(node.parent)
|
||||||
const parsedFilePath = path.parse(fileNode.relativePath)
|
const parsedFilePath = path.parse(fileNode.relativePath)
|
||||||
const slug = createFilePath({ node, getNode })
|
const slug = createFilePath({ node, getNode, basePath: 'content' })
|
||||||
const section = parsedFilePath.dir
|
const section = parsedFilePath.dir
|
||||||
|
|
||||||
createNodeField({
|
createNodeField({
|
||||||
|
33
plugins/gatsby-remark-relative-linker/index.js
Normal file
33
plugins/gatsby-remark-relative-linker/index.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// https://stackoverflow.com/a/48864225/733677
|
||||||
|
//
|
||||||
|
|
||||||
|
// const visit = require('unist-util-visit')
|
||||||
|
|
||||||
|
// module.exports = ({ markdownAST }) => {
|
||||||
|
// visit(markdownAST, 'link', node => {
|
||||||
|
// if (node.url && node.url.endsWith('.md') && node.url.startsWith('./')) {
|
||||||
|
// node.url = node.url.replace(
|
||||||
|
// /(.*)\.(\w{2}).md(#.*)?$/gi,
|
||||||
|
// (match, base, hash) => {
|
||||||
|
// return `/`
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (
|
||||||
|
// node.url &&
|
||||||
|
// node.url.endsWith('.md') &&
|
||||||
|
// node.url.startsWith('../')
|
||||||
|
// ) {
|
||||||
|
// node.url = node.url.replace(
|
||||||
|
// /(.*)\.(\w{2}).md(#.*)?$/gi,
|
||||||
|
// (match, base, hash) => {
|
||||||
|
// return `/`
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
// return markdownAST
|
||||||
|
// }
|
1
plugins/gatsby-remark-relative-linker/package.json
Normal file
1
plugins/gatsby-remark-relative-linker/package.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
Loading…
Reference in New Issue
Block a user