Markdown 如何修复代码块在hexo博客页面中无法工作的isuue?

Markdown 如何修复代码块在hexo博客页面中无法工作的isuue?,markdown,blogs,hexo,Markdown,Blogs,Hexo,我刚刚使用github pages+hexo创建了我的hexo博客。但是,当使用代码块时,它根本不起作用,我想知道如何修复它。 md文件中的代码为: ```js var allp=$("div p"); allp.attr("class",function(i,n){ return Number(n)+1; }); ``` ```js allp.each(function(){ console.log(this);

我刚刚使用github pages+hexo创建了我的hexo博客。但是,当使用代码块时,它根本不起作用,我想知道如何修复它。 md文件中的代码为:

```js
var allp=$("div p");
allp.attr("class",function(i,n){
           return Number(n)+1;
      });
```      

```js
allp.each(function(){
        console.log(this);
        });
```
但在浏览器中,我看到的是:


我尝试了很多方法来修复它,但都失败了。顺便说一句,我用的是hexo的下一个主题。

我想你需要的是这个

{%code块代码片段1 lang:js%}
var allp=$(“p类”);
allp.attr(“类”,函数(i,n){
返回编号(n)+1;
});
{%endcodeblock%}
{%code块代码段2 lang:js%}
allp.each(函数(){
console.log(this);
});

{%endcodeblock%}
我想你需要的是这个

{%code块代码片段1 lang:js%}
var allp=$(“p类”);
allp.attr(“类”,函数(i,n){
返回编号(n)+1;
});
{%endcodeblock%}
{%code块代码段2 lang:js%}
allp.each(函数(){
console.log(this);
});

{%endcodeblock%}
也许您可以尝试以下步骤:
1.在主题的_config.yml中启用高亮显示,尤其是“自动检测”

 highlight:
      enable: true
      auto_detect: true
      line_number: true
      tab_replace:
  • 通过hexo clean清理缓存

  • 通过
    hexo s
    重新启动服务器


  • 也许您可以尝试以下步骤:
    1.在主题的_config.yml中启用高亮显示,尤其是“自动检测”

     highlight:
          enable: true
          auto_detect: true
          line_number: true
          tab_replace:
    
  • 通过hexo clean清理缓存

  • 通过
    hexo s
    重新启动服务器