First time here? Check out the FAQ!
0

Is there a way to escape the < character?
 

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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Benoit's avatar
875
Benoit
asked 14 years ago

Comments

see more comments

2 Answers

1

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. http://www.ascii.cl/htmlcodes.htm

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
kraryal's avatar
26
kraryal
answered 14 years ago
link

Comments

see more comments
0

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.

{{somevalue|escape}}

and it will do what @kraryal said automatically.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
updated 14 years ago, answered 14 years ago
link

Comments

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 (14 years ago)
see more comments