GithubHelp home page GithubHelp logo

Comments (7)

rujews avatar rujews commented on August 17, 2024

@liuhan907 恩,这个我第一个版本的时候尝试过,也遇到了这个问题,这个问题的主要原因是MD生成的HTML没有对应的class样式。我正在想办法解决这个问题,如果你有,也欢迎PR贡献。

from maupassant-hugo.

JokerQyou avatar JokerQyou commented on August 17, 2024

我找到最简单的解决办法是把 {{ .Content }} 改为:

{{ .Content | replaceRE "<pre>" "<pre class=\"line-numbers\">" | safeHTML }}

但是这个方法看起来一点都不优雅……而且总觉得有点安全隐患

from maupassant-hugo.

rujews avatar rujews commented on August 17, 2024

@JokerQyou 恩,因为Hugo推荐的是内置的 Chroma 的方式,开渲染代码高亮。

from maupassant-hugo.

JokerQyou avatar JokerQyou commented on August 17, 2024

我最后用魔改 Prism 的 line-numbers 插件代码实现了……虽说还是有点脏。就是去掉了 js 里面对于那个 class 的需求。

from maupassant-hugo.

buzzers avatar buzzers commented on August 17, 2024

问题是内置的那个Chroma生成的东西总是有问题,样式冲突还是怎么回事我不是很清楚。

from maupassant-hugo.

fcying avatar fcying commented on August 17, 2024

写代码的时候 用

```shell   ```
shell高亮(用go c 测试都有)就有行号了...
只用``` 的时候没有

from maupassant-hugo.

rujews avatar rujews commented on August 17, 2024

恩,要有指定对应的语言 @fcying

from maupassant-hugo.

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.