jamdocs
jamdocs copied to clipboard
Control level of header nodes processed in sidebar
This is a feature request.
The sidebar is processing all my h2-h6 headings in my markdown as subtopics in the sidebar. Would be nice to be able to tell jamdocs that i only want to process h2-h3 or i dont want to process h6 or h5. This will give me more flexibility to control what gets added to the sidebar because some of our docs use a lot of headers.
Would be very cool if this can be a global and/or per document setting.
Thanks!
FYI, your template is great! thanks for all the work putting it together.
Will see if I can solve this as well. Just need a bit of time 👍
If it helps anybody else, this is the hardcoded approach I've taken so far:
In src/components/Sidebar.vue
modify the graphQL to include header depth
<static-query>
query Menu {
...
docs: allDoc {
edges {
node {
slug
headings {
depth
value
anchor
}
}
}
}
}
</static-query>
Add the following to methods under export default
(set your desired value accordingly):
methods: {
...
filterHeadings(headings) {
return headings.filter( h => {
return h.depth < 3
})
},
...
And finally modify the template JSX to call this filter function
<li v-for="heading in filterHeadings(node.headings)" :key="heading.value">
I don't know enough yet about vue/gridsome how to make this a configurable toggle