1
0
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:
Matthias Kretschmann 2018-11-08 16:03:16 +01:00
parent df085e3bfd
commit 6947ab48a2
Signed by: m
GPG Key ID: 606EEEF3C479A91F
5 changed files with 40 additions and 3 deletions

View File

@ -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/)

View File

@ -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'
] ]
} }
}, },

View File

@ -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({

View 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
// }

View File

@ -0,0 +1 @@
{}