Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
cspell-grammar
Advanced tools
cspell-grammar
CSpell Grammar is used to generate a parser. The Parser is used to add context / scope to parts of a document, making it easier to define the parts to spell spell checked.
This is to address the issues and limitations related to ignoreRegExpList
and includeRegExpList
.
The parser is use to add scope
to sections of a document. The scope
can then be used to apply spell checking rules.
Example: Only check comments and strings
rules:
'*': false
comment: true
string: true
It can be even more powerful like controlling the language settings based upon scope.
rules:
comment:
language: en
string:
language: en,fr
dictionaries: ['marketing-terms'],
caseSensitive: true
string.javascript:
caseSensitive: false
Rules are applied in the order they match the scope of the text.
When checking JavaScript files with the above example rules:
en,fr
marketing-terms
dictionary will be enabledcaseSensitive
will be true
en
caseSensitive
will be false
At its core, cspell-grammar
uses a simplified form of the TextMate grammar.
Why use a grammar parser? Couldn't a colorizer / highlighter or a language AST be used? At one level, needs of the spell checker are simpler and different from colorizers or language AST parsers. The goal of a spell checker is to spell check relevant text. The spell check does not need to care about the syntactical correctness of a document or presentation.
The goal of a grammar parser for the spell checker is to allow the user to decide:
Note: CSpell is a pure JavaScript application, so including the Oniguruma is not an option.
Consider the following bit of LaTeX:
k\"{o}nnen
können
For the spell checker to work correctly, the \"{o}
should be transformed into ö
before it is checked against the German dictionary.
This creates a few challenges.
Possible options:
FAQs
Grammar parsing support for cspell
The npm package cspell-grammar receives a total of 650,708 weekly downloads. As such, cspell-grammar popularity was classified as popular.
We found that cspell-grammar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.