Ask Your Question

Is there a way to escape the < character?

asked 2010-10-12 08:14:13 -0500

Benoit's avatar

I'm trying to have some text bracketed with <> like: < option >
However, if I don't put a space between the first < and the word, it is interpreted as an html tag.

Is there a way to escape the < ?

It's not a big deal, just a cosmetic issue.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2010-10-12 10:08:06 -0500

kraryal's avatar

To escape html characters, you usually want the & code for it.

For < use "&#60;" where you want "<".
For > use "&#62;" where you want ">".

This link has most of the characters.

edit flag offensive delete link more

answered 2010-10-12 12:09:56 -0500

Evgeny's avatar

updated 2010-10-12 12:10:10 -0500

where do you need to escape it? If it's in the django or jinja template (askbot master branch already switched to jinja - if you need help with porting any of your custom templates - pls let me know), then use "escape" filter on values.


and it will do what @kraryal said automatically.

edit flag offensive delete link more


Cool feature, but I don't think this would work right. I don't want to replace ALL instances of < I simply wanted a way to occasionally be able to write <option>. @kraryal provided a good way to do that.
Benoit's avatar Benoit  ( 2010-10-13 07:20:29 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2010-10-12 08:14:13 -0500

Seen: 205 times

Last updated: Oct 12 '10