سؤال

I'm newbie on Jekyll and I would like to highlight some JSON code. It seems pygments has some lexer for JavaScript but not for JSON. How do I must proceed to hightlight JSON code?

Thanks.

هل كانت مفيدة؟

المحلول

How about using JavaScript syntax highlighting? It should be highlighted as a JS object.

نصائح أخرى

Since JSON is just JavaScript, you should be able to use the JavaScript highlighter in Pygments.

The following code snippet should do what you want.

{% highlight javascript %}
{
  "key": "something",
  "more": "does not",
  "again": "nothing"
}
{% endhighlight %}

I may not have gotten the exact Liquid syntax right but that should get you started.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top