From a9e76db69c3a82d241538174eae73ca28100095a Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 4 Mar 2018 15:59:05 +0100 Subject: [PATCH] Docs: Mention support for `lang-xxxx` class. Close #1312 --- index.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index d251c8b2a1..2359ff5b6d 100644 --- a/index.html +++ b/index.html @@ -93,8 +93,8 @@

Full list of features

  • Encourages good author practices. Other highlighters encourage or even force you to use elements that are semantically wrong, like <pre> (on its own) or <script>. Prism forces you to use the correct element for marking up code: <code>. - On its own for inline code, or inside a <pre> for blocks of code. - In addition, the language is defined through the way recommended in the HTML5 draft: through a language-xxxx class.
  • + On its own for inline code, or inside a <pre> for blocks of code. + In addition, the language is defined through the way recommended in the HTML5 draft: through a language-xxxx class.
  • The language definition is inherited. This means that if multiple code snippets have the same language, you can just define it once, in one of their common ancestors.
  • Supports parallelism with Web Workers, if available. Disabled by default (why?).
  • Very easy to extend without modifying the code, due to Prism’s plugin architecture. Multiple hooks are scattered throughout the source.
  • @@ -138,8 +138,9 @@

    Basic usage

    Prism does its best to encourage good authoring practices. Therefore, it only works with <code> elements, since marking up code without a <code> element is semantically invalid. According to the HTML5 spec, the recommended way to define a code language is a language-xxxx class, which is what Prism uses. - To make things easier however, Prism assumes that this language definition is inherited. Therefore, if multiple <code> elements have the same language, you can add the language-xxxx class on one of their common ancestors. - This way, you can also define a document-wide default language, by adding a language-xxxx class on the <body> or <html> element. + Alternatively, Prism also supports a shorter version: lang-xxxx.

    +

    To make things easier however, Prism assumes that this language definition is inherited. Therefore, if multiple <code> elements have the same language, you can add the language-xxxx class on one of their common ancestors. + This way, you can also define a document-wide default language, by adding a language-xxxx class on the <body> or <html> element.

    If you want to opt-out of highlighting for a <code> element that is a descendant of an element with a declared code language, you can add the class language-none to it (or any non-existing language, really).

    @@ -170,7 +171,8 @@

    Basic usage

    Supported languages

    -

    This is the list of all languages currently supported by Prism, with their corresponding alias, to use in place of xxxx in the language-xxxx class:

    +

    This is the list of all languages currently supported by Prism, with + their corresponding alias, to use in place of xxxx in the language-xxxx (or lang-xxxx) class: