PageSourceSearch

https://yilab.org.cn/libs/codeBlock/codeLang.js

js yilab.org.cn collected 2026-10-07 17:33:02 UTC 560 bytes, 20 lines download raw bytes

1// 代码块语言识别
2
3$(function () {
4  var $highlight_lang = $('<div class="code_lang" title="代码语言"></div>');
5
6  $('pre').before($highlight_lang);
7  $('pre').each(function () {
8    var code_language = $(this).attr('class');
9
10    if (!code_language) {
11      return true;
12    };
13    var lang_name = code_language.replace("line-numbers", "").trim().replace("language-", "").trim();
14
15    // 首字母大写
16    // lang_name = lang_name.slice(0, 1).toUpperCase() + lang_name.slice(1);
17    
18    $(this).siblings(".code_lang").text(lang_name);
19  });
20});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.