【问题标题】:Why isn't Google Code Prettify working on css?为什么 Google Code Prettify 不在 CSS 上工作?
【发布时间】:2017-04-14 18:45:19
【问题描述】:

我在一些博客文章中使用 prettify.js。它可以很好地处理我的 html、python 和 js,但缺少 css。

我的html是:

<pre>
<code class="prettyprint lang-css">`

    .my-boxclass {
        display: inline-block;
        position: relative;
        cursor: help;
        border-bottom: 1px dotted grey;
    }
</code>
</pre>

我正在导入美化。这是我正在做的事情的 jsfiddle(也不是正确突出 jsfiddle 的语法) https://jsfiddle.net/kfdqLjm1/2/

【问题讨论】:

  • @Martin,感谢您的编辑,我有一段时间试图将其格式化为一个块

标签: html css syntax-highlighting pre google-code-prettify


【解决方案1】:

您需要加载 CSS 语言处理程序。尝试在run_prettify.js 之后添加?lang=css

【讨论】:

  • 成功了!只是出于好奇,你知道这是为什么吗?美化文档说自动包含 css。另外,这会阻止其他语言(例如python)被自动识别吗?
  • 我想我只是弄错了文档。您在哪些文档中看到了这个?
  • github.com/google/code-prettify 在自述文件中,FAQ->“它适用于哪些语言?” css 包含在列表中
  • “默认支持的文件扩展名包括:”缺少 CSS。有点傻,但可能是文件大小方面的考虑?
猜你喜欢
  • 2013-04-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多