-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(docs): move page config to dedicated files
- Loading branch information
Showing
7 changed files
with
117 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const { path } = require('@vuepress/utils') | ||
|
||
module.exports = path.resolve( | ||
__dirname, | ||
'../enhance/clientAppEnhance.js' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const anchorPlugin = require('markdown-it-anchor') | ||
|
||
// eslint-disable-next-line no-control-regex | ||
const rControl = /[\u0000-\u001f]/g | ||
const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'“”‘’<>,.?/]+/g | ||
const rCombining = /[\u0300-\u036F]/g | ||
|
||
const slugify = (str) => { | ||
return str | ||
.normalize('NFKD') | ||
// Remove accents | ||
.replace(rCombining, '') | ||
// Remove control characters | ||
.replace(rControl, '') | ||
// Replace special characters | ||
.replace(rSpecial, '-') | ||
// Remove continuos separators | ||
.replace(/-{2,}/g, '-') | ||
// Remove prefixing and trailing separators | ||
.replace(/^-+|-+$/g, '') | ||
// ensure it doesn't start with a number (#121) | ||
.replace(/^(\d)/, '_$1') | ||
// lowercase | ||
.toLowerCase() | ||
} | ||
|
||
module.exports = (md) => { | ||
md.use(require('markdown-it-attrs'), { | ||
allowedAttributes: ['id'], | ||
leftDelimiter: '[', | ||
rightDelimiter: ']', | ||
}) | ||
md.use(anchorPlugin, { | ||
level: [1, 2, 3, 4, 5, 6], | ||
slugify, | ||
permalink: anchorPlugin.permalink.ariaHidden({ | ||
class: 'header-anchor', | ||
symbol: '#', | ||
space: true, | ||
placement: 'before', | ||
}), | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = [ | ||
['link', { rel: 'icon', type: "image/png", sizes: "16x16", href: "/icons-fire-all-black/web/favicon.ico" }], | ||
['link', { rel: 'icon', type: "image/png", sizes: "32x32", href: "/icons-fire-all-black/web/favicon.ico" }], | ||
['link', { rel: "apple-touch-icon", sizes: "152x152", href: "/icons-fire-all-black/web/apple-touch-icon-152x152.png" }] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
extractHeaders: { level: [2, 3, 4, 5, 6] }, | ||
anchor: false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const { version } = require('../../../package.json') | ||
|
||
module.exports = [{ | ||
text: 'Getting Started', | ||
link: '/getting-started/', | ||
}, { | ||
text: 'API', | ||
children: [ | ||
{ | ||
text: 'Overview', | ||
link: '/api-overview/', | ||
}, | ||
{ | ||
text: 'API Best Practices', | ||
link: '/api-best-practices/', | ||
}, | ||
{ | ||
text: 'API Reference', | ||
link: '/api-reference/', | ||
} | ||
] | ||
}, | ||
{ | ||
text: `v${version}`, | ||
children: [ | ||
{ | ||
text: 'Changelog', | ||
link: 'https://github.com/discue/ui-components/blob/main/CHANGELOG.md', | ||
}, | ||
], | ||
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const { shikiPlugin } = require('@vuepress/plugin-shiki') | ||
const { sitemapPlugin } = require('vuepress-plugin-sitemap2') | ||
const { 'default': prismPlugin } = require('@vuepress/plugin-prismjs') | ||
|
||
module.exports = [ | ||
prismPlugin(false), | ||
sitemapPlugin({ | ||
hostname: 'https://docs.discue.io', | ||
excludeUrls: [ | ||
'https://docs.discue.io/api-reference/' | ||
] | ||
}), | ||
shikiPlugin({ theme: 'dark-plus' }) | ||
] |