Skip to content

Commit

Permalink
Add TIPs config
Browse files Browse the repository at this point in the history
  • Loading branch information
jlvandenhout committed Sep 16, 2023
1 parent 528984c commit 953bba7
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module.exports = async () => {
).map(async (contentConfig) => await create_doc_plugin(contentConfig)),
);

// Get tips and tutorials
const additionalPlugins = await glob(['docs/external/tips', 'tutorials']);
// Get tutorials
const additionalPlugins = await glob(['tutorials']);

const { MODE = 'development' } = process.env;

Expand Down Expand Up @@ -160,6 +160,38 @@ module.exports = async () => {
],
plugins: [
...contentPlugins,
[
'@docusaurus/plugin-content-docs',
{
id: 'iota-tips',
path: path.resolve(__dirname, './docs/external/tips'),
routeBasePath: 'tips',
editUrl: ({ docPath }) =>
`https://github.com/iotaledger/tips/edit/main/${docPath}`,
remarkPlugins: [require('remark-import-partial')],
include: ['tips/**/*.md', 'README.md'],

// Create own sidebar to flatten hierarchy and use own labeling
async sidebarItemsGenerator({
defaultSidebarItemsGenerator,
...args
}) {
const items = await defaultSidebarItemsGenerator(args);

const result = items[1].items.map((item) => {
if (item.type === 'category') {
if (item.link.type === 'doc') {
// Get TIP number and append TIP name
item.label = item.link.id.slice(-4) + '-' + item.label;
}
}
return item;
});

return [items[0]].concat(result);
},
},
],
[
'docusaurus-plugin-openapi-docs',
{
Expand Down

0 comments on commit 953bba7

Please sign in to comment.