By default, the Markdown theme will attempt to render standard CommonMark, suitable for the majority of Markdown engines. It follows the same structure and file patterns as the default HTML theme (see typedoc-default-themes).
The plugin also comes packaged with some additional built-in themes and can also be extended with a custom theme.
The Markdown theme packaged with the plugin can also be extended with a custom Markdown theme using the standard TypeDoc theming pattern as per https://typedoc.org/guides/themes/.
As per the theme docs create a theme.js file which TypeDoc will then attempt to load from a given location.
mytheme/custom-theme.js
const MarkdownTheme = require('typedoc-plugin-markdown/dist/theme');
class CustomMarkdownTheme extends MarkdownTheme.default {
constructor(renderer, basePath) {
super(renderer, basePath);
}
}
exports.default = CustomMarkdownTheme;By default the theme will inherit the resources of the Markdown theme (https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/src/resources).
These can be replaced and updated as required.
npx typedoc ./src --plugin typedoc-plugin-markdown --theme ./mytheme/custom-theme --out docs
const { Application } = require('typedoc');
const path = require('path');
const app = new Application({
module: 'CommonJS',
target: 'ES5',
readme: 'none',
theme: path.join(__dirname, 'mytheme', 'custom-theme'),
plugin: 'typedoc-plugin-markdown',
});
app.generateDocs(app.expandInputFiles(['./src']), 'docs');See https://typedoc.org/guides/installation/#node-module
The --out path is assumed be a Docusaurus docs directory.
- Adds Front Matter to pages to support Docusaurus Markdown Headers.
- Appends releavant JSON to website/sidebars.json|sidebars.js, to support sidebar navigation.
root-directory
├── docs
│ ├── myapi
│ | ├── classes
│ │ ├── enums
│ │ ├── interfaces
│ │ ├── index.md
│ │
└── website
├── sidebars.json
Manually add the index page to headerLinks in the siteConfig.js to access the api from header.
headerLinks: [
{ doc: "myapi/index", label: "My API" },
],-
Adds Front Matter to pages.
-
The --out path is assumed be a Vuepress docs directory.
-
Will create:
.vuepress/api-sidebar.jsonto be used with sidebar..vuepress/api-sidebar-relative.jsonto be used with multiple sidebars..vuepress/config.json
const apiSideBar = require('./api-sidebar.json');
// Without groups
module.exports = {
themeConfig: {
sidebar: ['some-content', ...apiSideBar],
},
};
// With groups
module.exports = {
themeConfig: {
sidebar: ['some-content', { title: 'API', children: apiSideBar }],
},
};const apiSideBarRelative = require('./api-sidebar-relative.json');
// Multiple sidebars
module.exports = {
themeConfig: {
sidebar: {
'/guide/': ['some-content'],
'/api/': apiSideBarRelative,
'/': ['other'],
},
},
};Note: this theme applicable to Bitbucket Cloud. If using Bitbucket Server please use the --namedAnchors argument to fix anchor links.
- Parses internal anchor links to support Bitbucket's internal anchor linking.