Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8543769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:23:14+00:00 2026-06-11T12:23:14+00:00

I would like to use the functionality of CodeMirror (such as linenumbering, wrapping, search,

  • 0

I would like to use the functionality of CodeMirror (such as linenumbering, wrapping, search, etc.) for plain text, without particular need of code highlightening but instead with Google Chrome spell checker or some other natural language (especially English) spell checking activated (I do not need to have it work on other browsers). How can I do this? Is it possible to write a plain text mode add-on that enables spell checking?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:23:16+00:00Added an answer on June 11, 2026 at 12:23 pm

    I actually integrated typo.js with CodeMirror while coding for NoTex.ch; you can have a look at it here CodeMirror.rest.js; I needed a way to get the reStructuredText markup spell checked, and since I use CodeMirror’s excellent syntax highlighting capabilities, it was quite straight forward to do.

    You can check the code at the provided link, but I’ll summarize, what I’ve done:

    1. Initialize the typo.js library; see also the author’s blog/documentation:

      var typo = new Typo ("en_US", AFF_DATA, DIC_DATA, {
          platform: 'any'
      });
      
    2. Define a regular expression for your word separators:

      var rx_word = "!\"#$%&()*+,-./:;<=>?@[\\\\\\]^_`{|}~";
      
    3. Define an overlay mode for CodeMirror:

      CodeMirror.defineMode ("myoverlay", function (config, parserConfig) {
          var overlay = {
              token: function (stream, state) {
      
                  if (stream.match (rx_word) &&
                      typo && !typo.check (stream.current ()))
      
                      return "spell-error"; //CSS class: cm-spell-error
      
                  while (stream.next () != null) {
                      if (stream.match (rx_word, false)) return null;
                  }
      
                  return null;
              }
          };
      
          var mode = CodeMirror.getMode (
              config, parserConfig.backdrop || "text/x-myoverlay"
          );
      
          return CodeMirror.overlayMode (mode, overlay);
      });
      
    4. Use the overlay with CodeMirror; see the user manual to figure out how exactly you do this. I’ve done it in my code so you could check it out there too, but I recommend the user manual.

    5. Define CSS class:

      .CodeMirror .cm-spell-error {
           background: url(images/red-wavy-underline.gif) bottom repeat-x;
      }
      

    This approach works great for German, English and Spanish. With the French dictionary typo.js seems to have some (accent) problems, and languages like Hebrew, Hungarian, and Italian – where the number of affixes is long or the dictionary is quite extensive – it does not work really, since typo.js at its current implementation uses too much memory and is too slow.

    With German (and Spanish) typo.js can block the JavaScript VM for a few hundred milliseconds (but only during initialization!), so you might want to consider background threads with HTML5 web workers (see CodeMirror.typo.worker.js for an example). Further typo.js does not seem to support Unicode (due to JavaScript restrictions): At least, I did not manage to get it to work with non-Latin languages like Russian, Greek, Hindi etc.

    I’ve not refactored the described solution into a nice separate project apart from (now quite big) NoTex.ch, but I might do it quite soon; till then you’ve to patch your own solution based on the above description or hinted code. I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to implement or use functionality that allows stepping through a Table
I would like to use Maven's password encryption such as it uses for nodes
I would like to use WatiN to test the functionality of a website I'm
I'm writing a C++ program for which I would like to use some functionality
I would like to use http://code.google.com/p/stateless in my code to separate the functionality from
I would like to use Decode functionality in SQLite select statement. From what I
I would like to use jQuery TypeAhead functionality on my site. I would like
I would like to use the ViewPager functionality and download Support Package: revision 4
I would like to use SQLite for some database functionality with a Java program
I would like to use Umbraco CMS. But I need to know is there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.