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 136757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:59:56+00:00 2026-05-11T06:59:56+00:00

Now i ran into some stupid situation. I want the users to be able

  • 0

Now i ran into some stupid situation. I want the users to be able to use textile, but they shouldn’t mess around with my valid HTML around their entry. So I have to escape the HTML somehow.

  • html_escape(textilize('</body>Foo')) would break textile while

  • textilize(html_escape('</body>Foo')) would work, but breaks various Textile features like links (written like 'Linkname':http://www.wheretogo.com/), since the quotes would be transformed into &quot; and thus not detected by textile anymore.

  • sanitize doesn’t do a better job.

Any suggestions on that one? I would prefer not to use Tidy for this problem. Thanks in advance.

  • 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. 2026-05-11T06:59:56+00:00Added an answer on May 11, 2026 at 6:59 am

    For those who run into the same problem: If you are using the RedCloth gem you can just define your own method (in one of your helpers).

     def safe_textilize( s )   if s && s.respond_to?(:to_s)     doc = RedCloth.new( s.to_s )     doc.filter_html = true     doc.to_html   end end 

    Excerpt from the Documentation:

    Accessors for setting security restrictions.

    This is a nice thing if you‘re using RedCloth for formatting in public places (e.g. Wikis) where you don‘t want users to abuse HTML for bad things.

    If filter_html is set, HTML which wasn‘t created by the Textile processor will be escaped. Alternatively, if sanitize_html is set, HTML can pass through the Textile processor but unauthorized tags and attributes will be removed.

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

Sidebar

Related Questions

Seems like I've ran into a wall here. I want some datasource to be
I've ran into a strange situation. I'm writing some test cases for my program.
Somewhat of an academic question, but I ran into this while writing some unit
This originally was a problem I ran into at work, but is now something
I ran git pull origin and now I have some issues with merge my
i'm writing some stuff in java and i ran into some problems lately. cut
Ran into some weird behaviour and wondering if anyone else can confirm what I
I'm working with a nullable DateTime object and ran into some strange behavior. Here's
When TransactionScope first came out, I ran into some serious issues getting it to
I ran into some trouble trying to implement a smart equality test macro-type template

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.