【问题标题】:Kramdown/coderay will not parse code snippets using html in Jekyl/OctopressKramdown/coderay 不会在 Jekyl/Octopress 中使用 html 解析代码片段
【发布时间】:2013-05-18 07:11:57
【问题描述】:

我有一个使用 Octopress 的网站(使用 Jekyl)。这是我想要显示颜色突出显示语法的代码块:

~~~
def what?
    42
end
~~~
{:lang='ruby}

如果这是在 file.markdown 文件中,则它被正确解析并且我看到了正确的代码语法。如果它在 file.html 中,则不会被解析为代码语法。我该怎么做才能在 html 文件中正确解析它?

【问题讨论】:

    标签: jekyll octopress coderay kramdown


    【解决方案1】:

    那个 does not work 了。使用

    ~~~
    def what?
      42
    end
    ~~~
    {:.language-ruby}
    

    或者更好

    ~~~ ruby
    def what?
      42
    end
    ~~~
    

    Example

    当文件扩展名为 html 时,Markdown 不起作用。

    降价can work with html.

    如果文件有 YAML Front Matter 部分,它将是 被杰基尔改造。任何 .html、.markdown、.md、 或 .textile 文件位于您网站的根目录或未列出的目录中 以上。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      • 1970-01-01
      • 1970-01-01
      • 2011-02-19
      • 2023-04-02
      相关资源
      最近更新 更多