mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Refine the auto-link selector.
This commit is contained in:
@@ -41,12 +41,12 @@ const hlTypes = [
|
||||
* @param {Object} $ The Cheerio object.
|
||||
*/
|
||||
function autoLink($) {
|
||||
$('code').each(function() {
|
||||
$('.doc-container code').each(function() {
|
||||
const $code = $(this);
|
||||
const html = $code.html();
|
||||
if (/^_\.\w+$/.test(html)) {
|
||||
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