Comments (7)
@liuhan907 恩,这个我第一个版本的时候尝试过,也遇到了这个问题,这个问题的主要原因是MD生成的HTML没有对应的class样式。我正在想办法解决这个问题,如果你有,也欢迎PR贡献。
from maupassant-hugo.
我找到最简单的解决办法是把 {{ .Content }}
改为:
{{ .Content | replaceRE "<pre>" "<pre class=\"line-numbers\">" | safeHTML }}
但是这个方法看起来一点都不优雅……而且总觉得有点安全隐患
from maupassant-hugo.
@JokerQyou 恩,因为Hugo推荐的是内置的 Chroma 的方式,开渲染代码高亮。
from maupassant-hugo.
我最后用魔改 Prism 的 line-numbers 插件代码实现了……虽说还是有点脏。就是去掉了 js 里面对于那个 class 的需求。
from maupassant-hugo.
问题是内置的那个Chroma生成的东西总是有问题,样式冲突还是怎么回事我不是很清楚。
from maupassant-hugo.
写代码的时候 用
```shell ```
shell高亮(用go c 测试都有)就有行号了...
只用``` 的时候没有
from maupassant-hugo.
恩,要有指定对应的语言 @fcying
from maupassant-hugo.
Related Issues (20)
- 手机端-每篇文章的访问量统计有误? HOT 3
- 切换标签为何不能选中状态 HOT 1
- 分类如何实现
- 请问下插入图片如何修改尺寸
- 多级分类 HOT 2
- 申请加入gitalk评论功能 HOT 1
- 如何新建分类、标签,路过的大佬救救孩子吧! HOT 1
- 一些小需求(期望交流) HOT 4
- 配置了 googleAnalytics 好像生效生效 HOT 3
- [问题]新建菜单,菜单下如何挂载文章 HOT 2
- 申请加入深色浅色切换功能 HOT 2
- hugo v0.96.0 代码块越界 HOT 1
- Hugo的错误链接localhost HOT 1
- 是否可以支持一下脑图?
- description 的内容不是文章摘要吗? HOT 2
- 老大你好,看文档说支持插入视频 HOT 1
- 本地搜索只能搜索标题,不能搜索正文;独立页面没有代码复制功能 HOT 4
- 增加国际化支持后,samplesite语言设置作调整,且有两个位置无法实现国际化 HOT 1
- 增加国际版后的问题 HOT 2
- 请求支持一款特别漂亮的标签 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 maupassant-hugo.