import React, { Component } from 'react'; import Link from 'gatsby-link'; /** * Maually get table of contents since tableOfContents from markdown * nodes have code added. * * https://github.com/gatsbyjs/gatsby/issues/5436 */ class TableOfContents extends Component { state = { headings: [] }; componentDidMount() { const contentHeadings = document.querySelectorAll('.docs-content h2'); const headings = []; contentHeadings.forEach(h => { headings.push({ id: h.id, text: h.innerText }); }); this.setState({ headings }); } render() { const { headings } = this.state; return ( ); } } const DocsNav = ({ items, location }) => ( ); export default DocsNav;