Comments (4)
已更新 highlight.js 的bundle,让它能够识别更多语言。拉取最新的代码试试。
如果可以的话就回来关闭这个issue吧。
from hexo-theme-aero-dual.
只能说好一些了,但是对于很多代码仍然不支持高亮,如图,C++和Java的关键字竟然都没有高亮。。。
但是这个问题似乎是间歇性的,如图,同一片文章内都是Java这个高亮就没有问题:
可能是玄学问题。
from hexo-theme-aero-dual.
我发现highlight js会自己检测代码类型,官方页面在这
(虽然它说可以自定义,然而hexo这边是直接从markdown生成的,我控制不了代码块的class……)
你的第一段截图代码,它认为是R…… (即使我本地尝试的时候,在markdown里面已经声明是java)
我下载的bundle里面应该是没有R吧,即使有,高亮出来跟你的代码应该对不上的,因为本来类型就错了。
有一个比较折腾的解决方法,就是使用hexo自带的landscape主题的代码高亮来替换我的方案:
- 复制 landscape 的 highlight.styl
(其中有些变量在_variables.styl,缺少的话编译的时候会报错,报哪个出错,就过去复制哪个,就行了。我这边尝试过,补上font-size
,line-height
,font-mono
,article-padding
这几个基本就ok了。)
-
替换我的 code.styl (areo_dual/source/css/_typography/code.styl) 里面的内容,然后把其中的
.article-entry
class 改成.post-content
-
把 highlight.js 的引入屏蔽(注释 aero-dual/layout/_partial/after-footer.ejs 里面的全部内容)
写到这里,我有一个大胆的猜想,就是直接屏蔽我的 code.styl 和 after-footer.ejs 内容,然后直接在 html-head.ejs 里面引入github的样式,或许也是可行的。github的样式在人家的文章里面看到有这个
<link rel="stylesheet" href="//cdn.bootcss.com/highlight.js/9.2.0/styles/github.min.css">
,还有这里的CDN地址,如果速度慢,就整个拿下来放到项目里吧
上面这三个步骤折腾完毕的效果:
希望能对你有所帮助,以上!
from hexo-theme-aero-dual.
感谢,我会试一试的。
不过希望您写的这篇文章可以加入wiki。
from hexo-theme-aero-dual.
Related Issues (20)
- Doubt about hexo's multilanguages HOT 2
- 更新留言板块啊老铁 HOT 1
- how to set abstract? HOT 2
- How to write the excerpt? HOT 2
- 代码块的字体问题
- 代码块和代码行数没有对齐的问题 HOT 2
- 摘要,标签和分类问题 HOT 1
- 怎么样添加一个新的页面 HOT 1
- 为什么添加摘要会将md转义为html
- 请问README中的那个黑白城市图片能提供吗?
- 如何设置为封面图的样式? HOT 1
- 首页摘要不显示 HOT 1
- 请问怎么实现图片中的左边白色背景,右边黑色背景的啊 HOT 1
- 诚邀合作事宜
- 下载Theme文件夹
- 请问如何添加文章摘要? HOT 1
- Big God Help Support Duoshuo Comment Or Other HOT 1
- How to change code hightlight style to monikai-sublime.styl? HOT 2
- Support discuz or duoshuo? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hexo-theme-aero-dual.