GithubHelp home page GithubHelp logo

代码高亮无效 about hexo-theme-mdui HOT 12 CLOSED

halyul avatar halyul commented on August 17, 2024
代码高亮无效

from hexo-theme-mdui.

Comments (12)

wekerSnail avatar wekerSnail commented on August 17, 2024

查看了我的页面和demo页面code部分生成的就不对
我的:
image
demo:
image

导致我的页面有加载高亮样式,但是没有匹配到正确的元素,这是什么原因导致的

from hexo-theme-mdui.

wekerSnail avatar wekerSnail commented on August 17, 2024

经过调试,发现貌似是prism.js这个文件中的after_post_render中的函数没有运行
image
我这边的console没有任何位置看到有输入,下面的替换应该也是这个原因没有替换成正确的标签,暂时不知道怎么解决

from hexo-theme-mdui.

Halyul avatar Halyul commented on August 17, 2024

请确认是否已经按照文档安装下列插件

$ npm install prismjs node-sass-magic-importer node-sass node-prismjs --save

from hexo-theme-mdui.

wekerSnail avatar wekerSnail commented on August 17, 2024

都已经安装过了,我发现貌似和hexo 版本有关系,我使用3.8不行,使用3.1就会运行,但是使用3.1仍然会有问题,
image这边的zheng正则匹配是会匹配不到,因为我页面生成的标签上,code是没有class的,所以我想问一下,这个代码高亮是能直接识别我的markdown语法的吗,还是写法上有区别

from hexo-theme-mdui.

Halyul avatar Halyul commented on August 17, 2024

是直接匹配渲染后的文章内容,能否提供一下Markdown文件,待我有时间我看一下

from hexo-theme-mdui.

wekerSnail avatar wekerSnail commented on August 17, 2024

下载地址 这是其中一个需要代码高亮的,麻烦帮看一下,我目前试了hexo 3.8.0和hexo 3.1.0 都有问题
pack.json这是我现在的package.json文件

from hexo-theme-mdui.

wekerSnail avatar wekerSnail commented on August 17, 2024

问题已经解决了,首先跟我自己的文件也有一点关系,我没有标注语言,然后主要问题是我的node版本是10.x的,hexo是3.8的,把这个两个分别改成8.x和3.1版本,就可以正常运行了

from hexo-theme-mdui.

VanLiuZhi avatar VanLiuZhi commented on August 17, 2024

问题还是热乎的啊,我也没法代码高亮,看来要降版本才能用

from hexo-theme-mdui.

Halyul avatar Halyul commented on August 17, 2024

我有时间会处理这个bug

from hexo-theme-mdui.

Halyul avatar Halyul commented on August 17, 2024

然而在我开发环境中 hexo 3.8 node 11.5均没有问题 我个人猜测是WIndows下的问题

from hexo-theme-mdui.

Halyul avatar Halyul commented on August 17, 2024

@wekerSnail 我下载你的markdown文件后 给代码加上语言定义 就能够渲染了 请你在hexo 3.8 node 11.5下测试一下

from hexo-theme-mdui.

wekerSnail avatar wekerSnail commented on August 17, 2024

@wekerSnail 我下载你的markdown文件后 给代码加上语言定义 就能够渲染了 请你在hexo 3.8 node 11.5下测试一下

更新主题版本测试确实可以了

from hexo-theme-mdui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.