doc: fix autoLink function, dont autolink from headers#6056
Merged
jonchurch merged 2 commits intolodash:mainfrom Dec 4, 2025
Merged
doc: fix autoLink function, dont autolink from headers#6056jonchurch merged 2 commits intolodash:mainfrom
jonchurch merged 2 commits intolodash:mainfrom
Conversation
jonchurch
commented
Dec 2, 2025
71c99d0 to
adb32a0
Compare
ljharb
approved these changes
Dec 2, 2025
Member
ljharb
left a comment
There was a problem hiding this comment.
we should definitely convert this to something less "parse regex from html"ish
UlisesGascon
approved these changes
Dec 3, 2025
Member
And add some smoke tests for this part. |
falsyvalues
approved these changes
Dec 3, 2025
adb32a0 to
c018667
Compare
Member
Author
|
just signed my existing commits and force pushed 🔐 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is for the tooling historically used to generate the HTML for the doc site
Problem
The weirdness we saw in lodash/lodash.com#300 (comment) was related to bugs in the preprocess and postprocess step in this repo when generating the doc site html.
We saw some md links to the source code not being converted into html, and double links in the h3s for some methods (the anchor link, then the h3 content itself wrapped in a link).
Solution
Change 1: the issue was that the preprocess step was only converting the md links that had both a source and an npm package link. The regexp just was too strict, and didnt match on the API surfaces that had a source link but no npm link (bc there is no npm package for things like
_.VERSION)Change 2: exclude headers from the autolinking behavior. The selector there was matching anything in
.doc-container codethat looked like a reference to a lodash method. But that also caught several headers.Context
The process when running
npm run doc:sitehtmlgoes:doc/README.mdlib/main/build-site.jsscript[source](the github source...)into html links