Internal link refactor to be more resilient across different markdown renderers #3128
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!
While working on an OpenAPI spec for the first time the other day, I noticed that internal links on github didn't seem to be working. Upon closer inspection, I noticed that the links were trying to reference an anchor tag within the header which used a camelCase convention as opposed to a snake-case one. I believe when Github renders markdown, it removes these explicit anchor tags and instead uses the traditional snake-case ones which are generated by markdown.
For example, rather than the line
#### <a name="parameterObject"></a> Parameter Object
being rendered as<h4 id="parameterObject">Parameter Object</h4>
, it was instead rendered as<h4 id="parameter-object">Parameter Object</h4>
.To rectify this, I replaced all of the old camelCase references with snake-case versions. However, I didn't want to disrupt any downstream workflows which utilized this
<a>
tag, so I also converted that value found there from camelCase to snake-case. I believe this should improve the viewing experience on Github while not breaking anything downstream.I'd love to hear opinions on this solution, or if it is even one y'all are interested in!
Thanks