MOxFIVE / hexo-theme-yelee

简而不减 Hexo 双栏博客主题; Another simple and elegant theme for Hexo.
http://moxfive.xyz/
1.38k stars 328 forks source link

无序列表小圈圈不显示 #214

Open Durant35 opened 7 years ago

Durant35 commented 7 years ago

image

wangriyu commented 6 years ago

main.js 里对 markdown 解析的无序列表中,将“- [ ]”和“- [x]”解析为复选框,但使用无序列表时“- [列表名]”,如果列表名前两个字符含x时,就会出现没有前缀小圈圈的请况。我是这样改的:

    // Task lists in markdown
    $('ul > li').each(function() {
        var taskList = {
-           field: this.textContent.substring(0, 2),
+           field: this.textContent.substring(0, 3),
            check: function(str) {
-              var re = new RegExp(str);
-              return this.field.match(re);
+              return this.field === str;
            }
        }

或者改一下正则规则也可以