typedoc-plugin-markdown icon indicating copy to clipboard operation
typedoc-plugin-markdown copied to clipboard

Integration with VitePress?

Open ericjeker opened this issue 3 years ago • 12 comments

VitePress has a different way of handling plugins. Plugins are now in Themes.

As we wanted to use TypeDoc and VitePress for the documentation of Faker.js, we were wondering what would be the best approach for that? Do you see this as a quick fix or should we create a new Vitepress theme by contributing to your repo maybe?

ericjeker avatar Jan 23 '22 05:01 ericjeker

Sure will take a look...Without plugin life-cycle hooks it will make it more of a manual setup but can look into best way to integrate. Need to update the docs to explain properly how to extend the themes too.

tgreyuk avatar Jan 23 '22 22:01 tgreyuk

Hi Tom, just FYI, we were able to generate something automagically with a script here (thanks to @ST-DDT effort) but not sure if that's useful for you or if there is any way to integrate that back to your repo? It's indeed very manual-ish, as you said, as it seems there are no more hooks we can attach this to in Vitepress.

ericjeker avatar Jan 25 '22 05:01 ericjeker

It is possible to create vitepress plugin as vite/rollup plugins

emersonbottero avatar Oct 01 '22 03:10 emersonbottero

Any updates or is it possiable for vitepress?

terwer avatar Apr 01 '23 20:04 terwer

If still of interest have created a theme that will preset options for use with VitePress and generate a sidebars file: https://github.com/tgreyuk/typedoc-plugin-markdown/tree/next/packages/typedoc-vitepress-theme#readme . Requires pre-release versions to be installed.

tgreyuk avatar May 13 '23 22:05 tgreyuk

Do you have screenshots or a demo deployment for reference purposes?

ST-DDT avatar May 14 '23 07:05 ST-DDT

Do you have screenshots or a demo deployment for reference purposes?

I will set up a demo repo.

tgreyuk avatar May 14 '23 08:05 tgreyuk

Hi, I am interested in a demo too @tgreyuk

I tried setting up a repo according to instruction here: https://github.com/tgreyuk/typedoc-plugin-markdown/tree/next/packages/typedoc-vitepress-theme#readme

but I get

> [email protected] publish-typedoc /home/wighawag/dev/github.com/wighawag/fuzd/docs
> typedoc --options typedoc.json

[info] Loaded plugin typedoc-plugin-markdown
[error] The plugin typedoc-vitepress-theme could not be loaded.
[error] TypeError: typedoc_plugin_markdown_1.MarkdownPluginOptionsReader is not a constructor
    at load (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/[email protected][email protected]/node_modules/typedoc-vitepress-theme/dist/index.js:46:27)
    at loadPlugins (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/[email protected][email protected]/node_modules/typedoc/dist/lib/utils/plugins.js:31:23)
    at async Application.bootstrapWithPlugins (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/[email protected][email protected]/node_modules/typedoc/dist/lib/application.js:102:9)
    at async run (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/[email protected][email protected]/node_modules/typedoc/dist/lib/cli.js:56:5)

I guess typedoc-vitepress-theme is expecting a different version of typedoc-plugin-markdown as it try to import MarkdownPluginOptionsReader from the typedoc-plugin-markdown module

Is that a specifc version ?

wighawag avatar Jul 05 '23 07:07 wighawag

anyone could get that working ?

Edit: Actually for some reason, I was not on latest "next" version. after fixing this, I got it working. Thanks !

wighawag avatar Aug 16 '23 15:08 wighawag

Hi, I am interested in a demo too @tgreyuk

I tried setting up a repo according to instruction here: https://github.com/tgreyuk/typedoc-plugin-markdown/tree/next/packages/typedoc-vitepress-theme#readme

but I get

> [email protected] publish-typedoc /home/wighawag/dev/github.com/wighawag/fuzd/docs
> typedoc --options typedoc.json

[info] Loaded plugin typedoc-plugin-markdown
[error] The plugin typedoc-vitepress-theme could not be loaded.
[error] TypeError: typedoc_plugin_markdown_1.MarkdownPluginOptionsReader is not a constructor
    at load (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/[email protected][email protected]/node_modules/typedoc-vitepress-theme/dist/index.js:46:27)
    at loadPlugins (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/[email protected][email protected]/node_modules/typedoc/dist/lib/utils/plugins.js:31:23)
    at async Application.bootstrapWithPlugins (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/[email protected][email protected]/node_modules/typedoc/dist/lib/application.js:102:9)
    at async run (/home/wighawag/dev/github.com/wighawag/fuzd/node_modules/.pnpm/[email protected][email protected]/node_modules/typedoc/dist/lib/cli.js:56:5)

I guess typedoc-vitepress-theme is expecting a different version of typedoc-plugin-markdown as it try to import MarkdownPluginOptionsReader from the typedoc-plugin-markdown module

Is that a specifc version ?

I was getting the same error with both the latest @next versions (next.36 version for the markdown plugin). Did some experimenting, and after downgrading the markdown plugin version I've managed to get it working:

"typedoc-vitepress-theme": "1.0.0-next.0",
"typedoc-plugin-markdown": "4.0.0-next.11"

duckception avatar Dec 14 '23 15:12 duckception

@tgreyuk This is a difficult question to ask because it often comes across as needy or demanding, but it's purely a strategic question. Dealing with next code is always precarious, and we're totally fine with accepting the risk of it. But I was curious if anyone could provide any insight into how stable typedoc-vitepress-theme is currently?

No one has a crystal ball, so the answer of "idfk" is totally an acceptable answer 😂 But are we anticipating any major changes / overhauls between now and whenever this makes it to an official 1.0 release? Or is it looking pretty stable for now?

Again, no rush. Loving the work that's being done here, and super excited to use it. We have an immediate need for it, so we're going to go ahead and start using it, and we can provide some "beta tester feedback" for anything that we run into to help contribute as we start playing around with it. But I was thinking about throwing some stories in our backlog to anticipate breaking changes if you think you might refactor major pieces of it 🙂👍

Swivelgames avatar Jan 12 '24 18:01 Swivelgames

Hi @Swivelgames,

Thanks for asking the question and I'd like to say things are quite stable now after some recent breaking changes. The plugin simply breaking shouldn't happen again as there are some tests on the CI now. There may be a couple of option tweaks but that's about it. My main focus now is on stability and documentation, contributing guide etc.

It would be great if you could start using it and provide feedback. I can normally fix things pretty quickly and happy to look into any feature requests.

A couple of links of interest:

  • A new docs website (if you haven't seen it) https://www.typedoc-plugin-markdown.org
  • Vitepress demo on stackblitz - https://stackblitz.com/~/github.com/tgreyuk/typedoc-vitepress-theme-stackblitz

tgreyuk avatar Jan 12 '24 22:01 tgreyuk

Thanks! this worked for me

  "typedoc-plugin-markdown": "^4.0.0-next.54",
    "typedoc-vitepress-theme": "^1.0.0-next.8",

am2222 avatar Mar 22 '24 21:03 am2222