title: Is there a way to check if text string is valid HTML in Rails?
body: <p>I am writing a simple CMS in Rails 4. And I am storing my articles in database as text strings that contains HTML code (not necessary).</p>
  
  <p>Anyway, I need a method to check before saving, if the text of the article is valid HTML or nor (considering that the article is not full HTML document, but the part of it, without DOCTYPE and other stuff). Something like this: <a href="https://validator.w3.org/#validate_by_input+with_options" rel="nofollow">https://validator.w3.org/#validate_by_input+with_options</a> ("Validate HTML fragment"), but working inside my Rails application as validation method of the model, so if my markup is wrong, it should not save the article and show the error message instead.</p>
  
  <p>Is there a gem or other method to do this?</p>