# Embedded HTML validation in a RoR app?

**URL:** <https://www.ruby-forum.com/t/embedded-html-validation-in-a-ror-app/171070>\
**Category:** Rails\
**Created:** [June 25, 2009, 11:47pm UTC](https://www.ruby-forum.com/t/embedded-html-validation-in-a-ror-app/171070 "2009-06-25T23:47:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [June 25, 2009, 11:47pm UTC](https://www.ruby-forum.com/t/embedded-html-validation-in-a-ror-app/171070/1 "2009-06-25T23:47:39Z")

</div>

Anyone ever done HTML validation of an arbitrary piece of HTML within  
their RoR app.? Any gems/plugins that would work? Would Hpricot do the  
trick?

Thanks,  
Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [June 26, 2009, 4:33am UTC](https://www.ruby-forum.com/t/embedded-html-validation-in-a-ror-app/171070/2 "2009-06-26T04:33:54Z")

</div>

On Jun 25, 5:47 pm, Wes G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Anyone ever done HTML validation of an arbitrary piece of HTML within  
> their RoR app.? Any gems/plugins that would work? Would Hpricot do the  
> trick?

Are you perchance looking for something like  
[GitHub - wr0ngway/assert\_valid\_markup: Fork of assert\_valid\_markup, sped up by using xmllint locally rather than hitting w3c service](http://github.com/wr0ngway/assert_valid_markup/tree/master) ? I’ve  
never tried that, but I plan to experiment with putting it into my  
automated specs if it works well.

> ## Thanks, Wes
> 
> Posted viahttp://www.ruby-forum.com/.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [June 26, 2009, 6:44am UTC](https://www.ruby-forum.com/t/embedded-html-validation-in-a-ror-app/171070/3 "2009-06-26T06:44:46Z")

</div>

Here’s my old crack at it. Probably newer code bases that do a better  
job.

> **[GitHub - kete/validates\_as\_sanitized\_html: If you have a model that has an...](https://github.com/kete/validates_as_sanitized_html/tree/master)**
>
> master

Cheers,  
Walter

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [June 26, 2009, 6:49am UTC](https://www.ruby-forum.com/t/embedded-html-validation-in-a-ror-app/171070/4 "2009-06-26T06:49:28Z")

</div>

BTW, assert\_valid\_markup looks to be aimed at functional tests and is  
about  
the HTML being standards compliant.

On Fri, Jun 26, 2009 at 4:43 PM, Walter McGinnis
