@bhsd/lezer-abusefilter
v0.1.2
Published
Lezer parser for MediaWiki extension AbuseFilter
Readme
@bhsd/lezer-abusefilter
This repository contains CodeMirror 6 language support for MediaWiki AbuseFilter syntax. Here is an online demo, with syntax highlighting, indentation, autocompletion, and code folding.
Installation
You can install the package via npm and import it as a module:
npm install @bhsd/lezer-abusefilterLanguage Support
It is recommended to dynamically generate language support for MediaWiki AbuseFilter with lists of predefined variables and functions from Extension:AbuseFilter. These lists will be used for better syntax highlighting and autocompletion.
import {abusefilter} from '@bhsd/codemirror-wikitext';
import type {LanguageSupport} from '@codemirror/language';
const langSupport: LanguageSupport = abusefilter({
functions: [],
variables: [],
deprecated: [], // List of deprecated variables
disabled: [], // List of disabled functions
});Language
You can also import the LR language for MediaWiki AbuseFilter alone. However, this will not include any predefined variables or functions for autocompletion.
import {abusefilterLanguage} from '@bhsd/lezer-abusefilter';Lint Source
This package also provides a lint source adapted from AbuseFilter analyzer for syntax checking.
import {analyzer} from '@bhsd/lezer-abusefilter';