Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Wants to spellcheck an HTML string properly? This gem is for you.
branch: master
Failed to load latest commit information.
lib Fix html entities handling and single quotes
.gitignore Initial version
MIT-LICENSE Initial version Initial version
html_spellchecker-0.1.7.gem Bump 0.1.7 with updated dependency on hunspell-ffi
html_spellchecker.gemspec Bump 0.1.7 with updated dependency on hunspell-ffi

HTML Spellchecker

Wants to spellcheck an HTML string properly? This gem is for you. It's powered by Nokogiri and hunspell-ffi!

How to use it

It's very simple. Install it with rubygems:

gem install html_spellchecker

Or, if you use bundler, add it to your Gemfile:

gem "html_spellchecker", :version => "~>0.1"

Then you can use it in your code:

require "html_spellchecker"
HTML_Spellchecker.english.spellcheck("<p>This is xzqwy.</p>")
# => "<p>This is <mark class="misspelled">xzqwy</mark>.</p>"

The HTML_Spellchecker class can be initialized by giving 2 paths: the affinity and dictionnary for hunspell. There are helpers to create a new instance for english and french dictionnaries.

Then, you can use spellcheck method: you give it an HTML string and it returns you with the same string with misspelled words enclosed in <mark> tags (with the misspelled class).

HTML_Spellchecker can avoid to check the spelling of special tags like <code>, by keeping a list of the tags to spellcheck in HTML_Spellchecker.spellcheckable_tags.

Issues or Suggestions

Found an issue or have a suggestion? Please report it on Github's issue tracker.

If you wants to make a pull request, please check the specs before:

rspec spec


Thanks Andreas Haller for the hunspell-ffi gem.

Copyright (c) 2011 Bruno Michel, released under the MIT license

Something went wrong with that request. Please try again.