-
Right now, we have a custom local plugin in a simple module.exports = {
presets: [
[
"@docusaurus/preset-classic",
{
docs: {
remarkPlugins: [require("./our-plugin")],
},
},
],
],
}; Can our plugin file be written in TypeScript? Would we need to build it manually, e.g. via TypeScript is supported for theme components but I'm not sure about plugins. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hmm I don't think we support config in TS for now, but maybe try and report :) Maybe it would be complicated to achieve (require running Docusaurus with ts-node) or not convenient (require compiling the plugin to js first), not sure? However you can probably get some autocompletion support with jsdoc annotations /** @type {import('@docusaurus/types').Plugin} */
function MyPlugin() {
return {
name,
};
} Can be good enough for now? Also we'll allow passing a function directly for the plugin so you could write more easily the plugin directly in the config file (if that make sense): #4618 |
Beta Was this translation helpful? Give feedback.
Hmm I don't think we support config in TS for now, but maybe try and report :)
Maybe it would be complicated to achieve (require running Docusaurus with ts-node) or not convenient (require compiling the plugin to js first), not sure?
However you can probably get some autocompletion support with jsdoc annotations
Can be good enough for now?
Also we'll allow passing a function directly for the plugin so you could write more easily the plugin directly in the config file (if that make sense): #4618