Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs) Small fixes in language guide and mode reference #3162

Merged
merged 7 commits into from May 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions docs/language-guide.rst
Expand Up @@ -163,7 +163,7 @@ Parameters for the function are:
Markup generation
-----------------

Modes usually generate actual highlighting markup — ``<span>`` elements with specific class names that are defined by the ``className`` attribute:
Modes usually generate actual highlighting markup — ``<span>`` elements with specific class names that are defined by the ``scope`` attribute:

::

Expand All @@ -180,7 +180,7 @@ Modes usually generate actual highlighting markup — ``<span>`` elements with s
]
}

Names are not required to be unique, it's quite common to have several definitions with the same name.
Scopes are not required to be unique; it's quite common to have several definitions with the same scope.
For example, many languages have various syntaxes for strings, comments, etc…

Sometimes modes are defined only to support specific parsing rules and aren't needed in the final markup.
Expand All @@ -194,7 +194,10 @@ A classic example is an escaping sequence inside strings allowing them to contai
contains: [{begin: '\\\\.'}],
}

For such modes, the ``className`` attribute should be omitted so they won't generate excessive markup.
For such modes, the ``scope`` attribute should be omitted so they won't generate excessive markup.

For a list of all supported scope names please see the :doc:`Scopes Reference
</css-classes-reference>`.


Mode attributes
Expand Down
6 changes: 3 additions & 3 deletions docs/mode-reference.rst
Expand Up @@ -216,9 +216,9 @@ of the function as ``title``. The space(s) between would be matched, but not
highlighted.

Note: Internally, each regular expression in the array becomes a capture group
inside a larger concatenated regex. *These regular expressions many NOT include
capture groups of their own yet.* If your regexes uses groups at all, they
**must** be non-capturing, i.e. ``(?:regex)``.
inside a larger concatenated regex. If your regular expressions use capture
groups (or references) they will be auto-magically renumerated so that they
continue to work without any changes.

For more info see issue `#3095 <https://github.com/highlightjs/highlight.js/issues/3095>`_.

Expand Down