Links in HTML Documentation generated by MATLAB not linking to correct location

5 views (last 30 days)
I used live MATLAB scripts to create documentation for some code. I used hyperlinks within the documentation to jump to different parts of the documentation. These links worked when I tested them in the live script.
However, when I exported the live scripts as HTML to use as documentation for a custom toolbox, I noticed the links didn't work anymore. When I clicked on them, they would jump to the table of contents at the top of the documentation rather than the section that I linked to within the document.
Does anyone know how to create these links so that they jump to the section I linked to in the documentation rather than the table of contents when I export to HTML?
Thank you.

Accepted Answer

Kshittiz
Kshittiz on 24 Jul 2023
Hey,
Please note that the HTML generated by MATLAB doesn't inherently support internal anchor links, this is why you are being redirected to the table of contents instead of the linked sections.
To create links that correctly jump to specific sections within the exported HTML documentation, you can use HTML anchor tags and IDs, i.e. :
i) In the live script, add an HTML anchor tag with a unique ID to the section you want to link to.
ii) Create a hyperlink to the section using the href attribute and the ID of the anchor tag.
I hope this helps.
Thanks

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!