vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
12.98k stars 2.09k forks source link

No outline generated after docs:build (Yes it is there when docs:dev) since alpha52 #2072

Closed arcqiufeng closed 1 year ago

arcqiufeng commented 1 year ago

Describe the bug

I upgrade to alpha52 then docs:build. Outline in page missing.

I tried docs:dev, it goes well.

Is it a bug?

Reproduction

I upgrade to alpha52 then docs:build. Outline in page missing.

I tried docs:dev, it is goes well.

Is it a bug?

Expected behavior

docs:dev and docs:build should be the same.

System Info

Windows 11

Additional context

No response

Validations

arcqiufeng commented 1 year ago

More:

Then I rollback to v1.0.0-alpha.51:

 yarn add -D vitepress@1.0.0-alpha.51

It works, outline is back after build.

brc-dd commented 1 year ago

Can you share your code? Our site is also using the latest version, but we are able to see the outline:

image
arcqiufeng commented 1 year ago

Maybe it is caused by badge.

I notice there is a break change in alpha52.

It really affected me. I have badges in headlines.

Can you add badges in headlines and tried it again?

My code is in LAN, and size is Large.

brc-dd commented 1 year ago

You mean having just the badge in whole heading? In that case, yeah that heading will be skipped πŸ‘€

Also not asking for the whole code, just a dummy file with 2-3 headings that demonstrates the problem will work.

arcqiufeng commented 1 year ago

I will try to reproduce it later.

In the third level of the title, the second level of the title, and there are badges like β€œto do” and so on.

arcqiufeng commented 1 year ago

It works well in dev mode.

brc-dd commented 1 year ago

It works well in dev mode.

Ah, ok. Then we need some code to reproduce the problem at our end. Can't suggest a fix without that πŸ‘€

arcqiufeng commented 1 year ago

In dev mode, the outline is there. And the badge was perfectly omitted. But it remains in the [[toc]]. Perfect is exactly what I was hoping for.

arcqiufeng commented 1 year ago

Now I can reproduce the bug:

Following:

W:\work\2023>md test & cd test  

W:\work\2023\test>yarn add -D vitepress

W:\work\2023\test>npx vitepress init

  vitepress v1.0.0-alpha.52

β”Œ   Welcome to VitePress! 
β”‚
β—‡  Where should VitePress initialize the config?
β”‚  ./docs
β”‚
β—‡  Site title:
β”‚  My Awesome Project
β”‚
β—‡  Site description:
β”‚  A VitePress Site
β”‚
β—‡  Theme:
β”‚  Default Theme
β”‚
β—‡  Use TypeScript for config and theme files?
β”‚  Yes
β”‚
β—‡  Add VitePress npm scripts to package.json?
β”‚  Yes
β”‚
β””  Done! Now run npm run docs:dev and start writing.

Now edit the file "markdown-examples.md" that automatically generated. Just add a badge into the title, as following:

## Syntax Highlighting<Badge type="danger" text="caution" />

Now we can test the file:

W:\work\2023\test>yarn docs:dev
yarn run v1.22.19
warning package.json: No license field
$ vitepress dev docs

  vitepress v1.0.0-alpha.52

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose

It works fine in http://localhost:5173/markdown-examples.html

Then I try to build it:

W:\work\2023\test>yarn docs:build
yarn run v1.22.19
warning package.json: No license field
$ vitepress build docs

  vitepress v1.0.0-alpha.52

βœ“ building client + server bundles...
βœ“ rendering pages...
build complete in 19.05s.
Done in 19.83s.

I copied all the stuffs into iis root. (C:\inetpub\wwwroot)

Now: http://127.0.0.1/markdown-examples.html The Page can be displayed but the outline is missing.

gvenusleo commented 1 year ago

I have a similar problem. In v1.0.0-alpha.52, Appearance switch button and custom css work with dev, but fail with preview. #2075

yyx990803 commented 1 year ago

Looks like alpha.53 didn't fix this, looking into it further...