vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.48k stars 4.78k forks source link

Add API to add page headings from within Vue components #2002

Open ptandler opened 4 years ago

ptandler commented 4 years ago

Feature request

What problem does this feature solve?

Currently, it is not possible to add headings that show up in TOC or sidebar from within Vue component templates.

An API to add page headings would allow components to make use of the sidebar="auto" feature.

(See related issue #1423 or https://stackoverflow.com/questions/55328002/how-to-generate-headings-from-within-vue-components-in-vuepress)

What does the proposed API look like?

I'm not that familiar with the VuePress architecture that I dare to propose an API.

How should this be implemented in your opinion?

Is there anything that is executed for components during build time?

Are you willing to work on this yourself?

If I get some help in designing such an API, I am willing.

larionov commented 4 years ago

We would like to have such API too @ulivz can we have some reply from core team if this feature will be considered so we can decide if we can try working on it?

fmonper1 commented 4 years ago

This would be a perfect feature when rendering sections from a JSON file. If theres anything I can do to help Ill do so willingfully!

staghouse commented 3 years ago

Any update on this?