No commit activity in last 3 years
No release in over 3 years
Wants to spellcheck an HTML string properly? This gem is for you.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.4

Runtime

 Project Readme

HTML Spellchecker

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

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

Credits

Thanks Andreas Haller for the hunspell-ffi gem.

Copyright (c) 2011 Bruno Michel bmichel@menfin.info, released under the MIT license