mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 20:07:49 +00:00
Refine the auto-link selector.
This commit is contained in:
@@ -41,12 +41,12 @@ const hlTypes = [
|
|||||||
* @param {Object} $ The Cheerio object.
|
* @param {Object} $ The Cheerio object.
|
||||||
*/
|
*/
|
||||||
function autoLink($) {
|
function autoLink($) {
|
||||||
$('code').each(function() {
|
$('.doc-container code').each(function() {
|
||||||
const $code = $(this);
|
const $code = $(this);
|
||||||
const html = $code.html();
|
const html = $code.html();
|
||||||
if (/^_\.\w+$/.test(html)) {
|
if (/^_\.\w+$/.test(html)) {
|
||||||
const id = html.split('.')[1];
|
const id = html.split('.')[1];
|
||||||
$code.html(`<a href="#${ id }">_.${ id }</a>`);
|
$code.replaceWith(`<a href="#${ id }"><code>_.${ id }</code></a>`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user