SCDoc HTML renderer includes literal spaces in links with anchors #1650
Labels
bug
Issues that relate to unexpected/unwanted behavior. Don't use for PRs.
comp: SCDoc
scdoc syntax, parser, and renderer. for changes to schelp files, use "comp: help"
Milestone
The SCDoc HTML renderer generates named anchors for section and subsection names. That makes sense.
Sections and subsections may have spaces in their titles. The named anchors don't take this into account. As a result, if you want to post a link to doc.sccode.org to a specific section, the following workflow is broken with some browsers:
You might get a link that looks something like this:
It turns out that Firefox on my computer automatically fixes the spaces when copying the URL. Other browsers don't. If I do this on my Android tablet, I get real space characters in the URL. If I don't fix them manually, then the recipient of an e-mail into which I have pasted the link will get a broken link. (This has been an annoyance for years.)
Here, I have updated SCDocHTMLRenderer:
https://github.com/supercollider/supercollider/tree/topic/fixSCDocToc
a451a06
But this doesn't completely fix the problem, because the links in the Table of contents are generated dynamically in JavaScript. My JavaScript is not up to snuff -- it'll take me too long to figure out how to fix it. I can see that the problem is in lines 551-593 of https://github.com/supercollider/supercollider/blob/master/HelpSource/scdoc.js but I don't know how to copy the existing link's "name" property into the new link generated by JS.
I pushed my change into a topic branch in the main SC repository, so anyone else can push the rest of the fix.
The text was updated successfully, but these errors were encountered: