Expand all

CodeMirrorMediaWikiConfig

Configuration for the MediaWiki highlighting mode for CodeMirror. This is a separate class mainly to keep static configuration out of the logic in CodeMirrorMediaWiki.

Properties

defaultTokenTable :Object.<Tag> #

These are custom tokens (a.k.a. tags) that aren't mapped to any of the standardized tags. Make sure these are also defined in customTags() above.

TODO: pass parent Tags in Tag.define() where appropriate for better theming.

Type:

Source:
See:
These are custom tokens (a.k.a.

implicitlyClosedHtmlTags :Object #

HTML tags that are only self-closing.

Type:

Source:
HTML tags that are only self-closing.

permittedHtmlTags :Object #

All HTML/XML tags permitted in MediaWiki Core.

Extensions should use the CodeMirrorTagModes extension attribute to register tags instead of adding them here.

Type:

Source:
See:
All HTML/XML tags permitted in MediaWiki Core.

tags :Object.<string> #

Mapping of MediaWiki-esque token identifiers to standardized lezer highlighting tags. Values are one of the default highlighting tags. The idea is to use as many default tags as possible so that theming (such as dark mode) can be applied with minimal effort. The semantic meaning of the tag may not really match how it is used, but as per CodeMirror docs, this is fine. It's still better to make use of the standard tags in some way.

Once we allow use of other themes, we may want to tweak these values for aesthetic reasons. The values here can freely be changed. The actual CSS class used is defined further down in highlightStyle().

Type:

Source:
See:

Mapping of MediaWiki-esque token identifiers to standardized lezer highlighting tags.

Methods

getTagStyles(context) → {Array.<TagStyle>} #

This defines the actual CSS class assigned to each tag/token. Keep this in sync and in the same order as tags().

Parameters:

Name Type Description
context StreamParser
Source:
See:

Returns:

Type
Array.<TagStyle>
This defines the actual CSS class assigned to each tag/token.