mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-18 21:53:26 +00:00
Create the code language badge by Liquid
It prevents the language badges from flashing
This commit is contained in:
@@ -25,7 +25,7 @@ $(function() {
|
||||
const title = nextTag.prop('tagName') === 'EM' ? nextTag.text() : '';
|
||||
const src = $(this).attr('data-src'); // created by lozad.js
|
||||
|
||||
$(this).wrap(`<a href="${src}" title="${title}" class="popup"></a>`);
|
||||
$(this).wrap(`<a href="${src}" title="${title}" class="popup img-link"></a>`);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -42,6 +42,4 @@ $(function() {
|
||||
|
||||
/* markup the image links */
|
||||
|
||||
$(`${IMG_SCOPE} a`).has("img").addClass('img-link');
|
||||
|
||||
});
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Add language indicator to code snippets
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
const prefix = "language-";
|
||||
const regex = new RegExp(`^${prefix}([a-z])+$`);
|
||||
|
||||
$(`div[class^=${prefix}`).each(function() {
|
||||
let classes = $(this).attr("class").split(" ");
|
||||
|
||||
classes.forEach((_class) => {
|
||||
if (regex.test(_class)) {
|
||||
let lang = _class.substring(prefix.length);
|
||||
$(this).attr("lang", `${lang}`);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user