Giter Club home page Giter Club logo

codemirror-spell-checker's Introduction

CodeMirror Spell Checker

Spell checking so simple, you can set up in 60 seconds. It will highlight any misspelled words in light red. Works great in conjunction with other CodeMirror modes, like GitHub Flavored Markdown.

Fork

This is a fork of sparksuite's codemirror-spell-checker.

Added fixes:

Screenshot

Install

Via npm.

npm install @edemaine/codemirror-spell-checker --save

Via bower.

bower install @edemaine/codemirror-spell-checker --save

Via jsDelivr. Please note, jsDelivr may take a few days to update to the latest release.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@edemaine/codemirror-spell-checker/latest/spell-checker.min.css">
<script src="https://cdn.jsdelivr.net/npm/@edemaine/codemirror-spell-checker/latest/spell-checker.min.js"></script>

Quick start

Once CodeMirror is installed and loaded, first provide CodeMirror Spell Checker with the correct CodeMirror function. Then, just set the primary mode to "spell-checker" and the backdrop mode to your desired mode. Be sure to load/require overlay.min.js if you haven't already.

CodeMirrorSpellChecker({
	codeMirrorInstance: CodeMirror,
});

CodeMirror.fromTextArea(document.getElementById("textarea"), {
	mode: "spell-checker",
	backdrop: "gfm" // Your desired mode
});

That's it!

Customizing

You can customize the misspelled word appearance by updating the CSS. All misspelled words will have the .cm-spell-error class.

.CodeMirror .cm-spell-error{
	/* Your styling here */
}

Configuration

  • customWords: Custom array of words that will not be designated as misspelled. Defaults to an empty array.
// Most options demonstrate the non-default behavior
CodeMirrorSpellChecker({
	codeMirrorInstance: CodeMirror,
	customWords: ["CodeMirror", "GitHub"],
});

codemirror-spell-checker's People

Contributors

edemaine avatar wescossick avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

codemirror-spell-checker's Issues

customWords

customWords is currently an array, so checking against it is slow. Allow for it to be an object whose keys are custom words.

Emoji

Emoji such as ๐Ÿ˜ข currently get highlighted as spellchecking errors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.