Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

How to call getHeadings() #519

Answered by jnahumphreys
jnahumphreys asked this question in Q&A
Discussion options

You must be logged in to vote

... I think I've worked this out, can close

// When passing some markdown content with headings
function EditorTest() {
  const editorInstance = useRef();

  useEffect(() => {
    const headings = editorInstance.current?.getHeadings();
    console.log(headings); // returns array of headings
  });

  return (
    <Editor defaultValue={markdownContent} ref={editorInstance} />
  );
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jnahumphreys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant