Open slorber opened 11 months ago
Thanks @slorber for forwarding the issue! I'll try to look into what API redoc makes available to get the anchor ids but since the rendering is done mostly by redoc and not by this plugin it's possible that this is unfixable. Will try still
I understand.
Isn't there a way to know the heading its ahead of time by using AppStore or the spec file?
You don't have to call collectAnchor(anchor)
in a heading component, you can do this at any level.
const {collectAnchor} = useBrokenLinks();
const anchors = getAnchorsFromSpec(spec);
anchors.forEach(collectAnchor);
The question is: can getAnchorsFromSpec(spec)
be implemented?
Hi
With Docusaurus v3.1 we introduced a broken anchors checker:
https://docusaurus.io/blog/releases/3.1#broken-anchors-checker
https://docusaurus.io/docs/docusaurus-core#useBrokenLinks
This requires collecting anchors for headings you create, otherwise Docusaurus doesn't know about those created anchors.
Note this api exists in Docusaurus 3.1 but not in 3.0 so you probably want to release a new major version requiring Docusaurus 3.1 to support this.
See also a Docusaurus user that gets reported Redocusaurus anchors links as broken:
https://github.com/facebook/docusaurus/issues/6810#issuecomment-1879387076