vitejs / vite-plugin-react-pages

A vite framework for building react app. Especially suitable for document site and demos/playgrounds of react components.
https://vitejs.github.io/vite-plugin-react-pages/
MIT License
459 stars 70 forks source link

The right anchor disappeared on some pages. #173

Closed zbczbc2006 closed 8 months ago

zbczbc2006 commented 8 months ago

library demo

In the above demo, the right anchor disappeared on introduction page and all components pages.

csr632 commented 8 months ago

The right anchors (outlines) are statically extracted from markdown file. The Introduction page in your demo don't have right anchors because the markdown file content is like:

---
title: Introduction
---

import README from '../../README.md';
<README />

Which actually don't have any title if we look at it statically (without running its code)!

In real practice, It is not recommended to import and render a component with title like this. For several reasons:

In real practice, we rarely import markdown component. If you really want the content, just copy the markdown text into the file.


"The components pages don't have right anchors" is a flaw of previous project templates. I have updated the project templates, you can open a new demo and check it out.

zbczbc2006 commented 8 months ago

"The components pages don't have right anchors" is a flaw of previous project templates. I have updated the project templates, you can open a new demo and check it out.

It worked, thanks!