Kramdown/coderay will not parse code snippets using html in Jekyl/Octopress

754 Views Asked by At

I have a website that is using Octopress (Which uses Jekyl). Here is my codeblock that I want to display the color highlighting syntax for:

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

If this is in a file.markdown file it is parsed correctly and I see the proper code syntax. If it is in file.html it is not parsed into a code syntax. What can I do to parse this correctly in an html file?

1

There are 1 best solutions below

0
On

That does not work anymore. Use

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

or better yet

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

Example

Markdown does not work when the file extension is html.

Markdown can work with html.

Provided that the file has a YAML Front Matter section, it will be transformed by Jekyll. The same will happen for any .html, .markdown, .md, or .textile file in your site's root directory or directories not listed above.