Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
codemirror-lang-spreadsheet
Advanced tools
Readme
Implements spreadsheet functions support for the CodeMirror v6 code editor 📜
To build this I used the paper "A Grammar for Spreadsheet Formulas Evaluated on Two Large Datasets" and XLParser as a basis.
🔠 Support for different idioms (and easily extensible to include new ones)
🧮 Support for different decimal separators
npm install codemirror-lang-spreadsheet
First import as shown below:
import {spreadsheet} from "codemirror-lang-spreadsheet";
Call the spreadsheet
function inside the editor instance. This function expects an options object as an argument. Available options are idiom
(string with desired language, eg "en-US"
) and decimalSeparator
(string with decimal separator: "."
or ";"
)
new EditorView({
extensions: [
// ... your other CodeMirror extensions
// ...
spreadsheet({
idiom: "en-US"
decimalSeparator: "."
})
],
parent: document.getElementById("editor")
});
👉 For a complete demo with highlighting, autocomplete and prettier go to: codemirror-app-spreadsheet
Idioms are used for keywords like booleans (TRUE
, FALSE
) and error tokens (like #REF!
, #NAME!
, ...).
Currently supported:
It's pretty simple to add support for other idioms. See the contribution section.
Contributions are welcome, but for every feature added, tests must be added.
To build:
npm run build
Running the tests:
npm run test
To add support for a new idiom follow the steps below:
In the tokens.ts
file, add the idiom as a new supported type:
TsupportedIdioms = 'en-US' | 'pt-BR';
Still in this file, for each of the i18n
object keys, add a value with the respective idiom translation. There is no fallback to a default idiom, so even if a token is the same in another idiom, it has to be repeated.
const i18n = {
BoolToken: {
'en-US': ['TRUE', 'FALSE'],
'pt-BR': ['VERDADEIRO', 'FALSO']
},
RefErrorToken: { // repeated token
'en-US': '#REF!',
'pt-BR': '#REF!'
},
//...
}
Now it is necessary to create tests. Create a new folder named after the idiom inside the test/i18n
folder. Copy the boolean.txt
and errors.txt
files from another idiom and adapt them to the new idiom.
This site is a good reference for translations.
When extending support for a new idiom open a PR 💙
FAQs
Spreadsheet language support for CodeMirror
The npm package codemirror-lang-spreadsheet receives a total of 161 weekly downloads. As such, codemirror-lang-spreadsheet popularity was classified as not popular.
We found that codemirror-lang-spreadsheet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.