Open pekkaklarck opened 4 hours ago
Thank you for the bug report / feature request @pekkaklarck, I think it makes a lot of sense. We can definitely consider "slugifying" titles when no identifier is provided (and after having tried with the actual title as id, probably). At first glance, this shouldn't cause any issue if we do this by default, but I'll have a deeper look :slightly_smiling_face:
That would be awesome! And yes, should first check is there a match with the original title before sluggifying.
I might be submitting this to a wrong project, but because I don't know any better place, and this is at least related to autorefs, I decided to submit it here. Feel free to close this if the place is wrong. If you know a better place, please let me know.
Let's first assume I have the following content:
When I have autorefs installed, I can very conveniently link to the Welcome section using this syntax:
This is very similar, and equally convenient, than the syntax I'm used to with reStructuredText and Sphinx:
The problem is that I'd typically like to refer to sections so that the name starts with a capital letter as below, but in this case auto-linking doesn't work:
There's also a problem with headings having spaces. For example, this doesn't work:
I know I can get both of the above to work by including the actual link target as below:
The problem with adding those link targets is that it requires writing redundant content, makes document source less readable and is inconsistent. Inconsistency also means you can easily forget to add the target when in some cases it is not needed. Notice that with reStructuredText and Sphinx these work out-of-the-box:
My first problem that
[Welcome][]
isn't handled case-insensitively feels like a bug to me, because according to the original Markdown spec, reference targets are case-insensitive. There is, for example, an example like this:The odd thing is that the above example is handled fine by MkDocs. It's strange that
[Google][]
works when the references target is[google]:
, but[Welcome][]
doesn't work when the reference target ought to be something similar.My second problem that
[just testing][]
is not linked to the generatedjust-testing
target is something where my wish is against the Markdown spec. This example from the spec wouldn't work if spaces would be automatically replaces with hyphens:Although I'm fighting against the spec, I feel that this syntax would be really convenient. Is it something autorefs could support? If there are backwards compatibility concerns, it didn't need to be enabled by default, but having an option to enable this behavior would be awesome. If this is something autorefs cannot do or it doesn't belong to its scope, do you have ideas how I could enable the behavior otherwise? I'm willing to implement a plugin if needed and would also be ready to provide a PR to autorefs if this feature could be added to it.