-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
link fragments should follow the GitHub heading algorithm #2393
Comments
You should use And, I would absolutely consider this a breaking change. For one, it would break https://github.com/JuliaDocs/DocumenterInterLinks.jl. (I can adapt to a new algorithm, of course, but it’s a semver-breaking release for both packages). Thus, I’m pretty strongly opposed to this. And I don’t think we should litter the HTML with additional redundant anchor tags. Although I do agree that it would have been nicer to emulate GitHub sluggification from the start, so we could put this in the log for when/if we get around to Documenter 2.0 |
The main interest is in maintaining a part of a README (designed to be read on GitHub) as part of Documenter, so a It's understandable not to want to do this, given an ecosystem which depends on the refs as they are. I hope you might consider an opt-in |
For that use case, I would recommend a snippet of code in your |
In my mind, I don't think the generated slugs are part of the Documenter public API though. Largely because I would love to clean them up at some point (at which point we could declare the algorithm to be public API). For the README use case, pre-processing the README seems to be the right way to go though. |
For what it's worth as a non-contributor user, I would consider outright changing the slug syntax to be breaking. Not only would it invalidate user links, it would invalidate document links into the documentation on other people's websites. Adding duplicates (in the common case where the GitHub-flavored slug and the Documenter-flavored slug differ) would not be breaking, and adding a keyword-option which enabled them (with or without the original ones) would definitely not be, added functionality is never breaking in SemVer. A script to add portions of the README to the Docs file is pretty easy, reprocessing the fragments is not, because the information needed to reconstruct the Document style isn't in the fragment, it's in the header. I'll probably go in the other direction, actually, since |
Link checkers (the link check we use in As for linking to documentation on other people's website, DocumenterInterLinks would solve that problem in principle, as it would either automatically adjust to new slugs or throw an error if linking to a non-existing slug. However, first I have to make a PR to add inventory writing to Documenter (#2366), then that has to be merged/released and then that new release has to become widely adopted. And even then, there are a lot of legacy docs with direct links to other |
My thinking on this might be evolving, due to sphinx-doc/sphinx#12008 (I'll see if I can fix the bug in Sphinx, though) |
This comes up a lot when you have a de-facto standard. CommonMark doesn't require github-flavored fragments, but they're presumed by a lot of tooling. CommonMark is also a specification for specifically-not-Markdown, at Gruber's insistence, but really Markdown is whatever you find in the wild. There was a similar effect when certain parties starting pushing to change "master" branches to "main", the former was a de-facto standard and it broke a lot of tooling. I'd argue in that case that the tooling was buggy, and probably in this case with Sphinx as well. But there's a case to be made for going with the flow on this one. Thanks for keeping the issue open. |
I've also tweaked the Thus, changing the sluggification algorithm would no longer be breaking, at least not for me. It would definitely break a lot of existing direct links in the wild, but maybe that would be a motivation for projects using such links to switch to |
Issue
A reference like
[Section](#section-name)
doesn't work, it must be[Section](#Section-Name)
, assuming the section name is titlecased. The former ought to be supported.Rationale
While the format of fragment links is not a part of the CommonMark standard, the convention used in GitHub is a strong one, many Markdown editing suites will only recognize document fragments if they are defined according to it, see this Markdown linting rule.
This would make documentation easier to write, and aid conversion of e.g. GitHub README.md files into Documenter documents, and would conform to the de-facto standard, which is always a good thing.
Fix
This doesn't have to be a breaking change, HTML allows for multiple fragment names using consecutive
<a name="fragment">
elements before the header in question.Another option is to add a
makedocs
option,githubheadings=true
, which would generate links in the accustomed style.Thank you for your hard work, and for considering this proposal.
The text was updated successfully, but these errors were encountered: