1
1

Hello,

I'm testing the osqa software and everything seems to work but I'm now having one problem when posting because I can write in the Markdown editor the backslash character and it is shown in the preview, and also when editing the message it appears again but when I enter the question it is shown weird, as if it have some problem regarding encoding or something else.

The issue appears when I try to use backslashes in html code, since I'm trying to setup LaTeX and in the mean time I will use this kind of "cheat" using images instead of jsMath.

The problem appears when I try to put something like this:

<img src="http://latex.codecogs.com/gif.latex?\\subset\\mathbb{R}^n" alt=""/>

The problem is this one:

If I use Markdown code instead of html it works. Why this happens? Using markdown image code: alt latex

In the preview, I see everything OK but in the question body after loading the page the backslashes are changed by something weird as you can see.

asked 27 Jul '10, 04:04

miguidotcom's gravatar image

miguidotcom
1812811
accept rate: 0%

edited 27 Jul '10, 04:06


That's because the html is sanitized in the input, and for some reason the sanitizer doesn't like your image tags :) The library responsible for the sanitization is html5lib, which is very powerfull and customizable, but at this point, the only option to configure it is by editing the source, under forum/utils/html.py .

link

answered 27 Jul '10, 06:34

Hernani%20Cerqueira's gravatar image

Hernani Cerq... ♦♦
16.8k65975
accept rate: 52%

But even if you dont input html... See:

frac{3}{5}

I have written a backslash which vanishes.

(27 Jul '10, 06:38) miguidotcom

Yes, but is definitely the sanitizer that is doing is stuff. The idea is to make XSS attacks and that kind of crap impossible. I was thinking that one thing that may be usefull in your case is to plug in the markdown2latex extension see http://www.rufuspollock.org/2008/06/23/markdown2latex-mkdn2latex-12/ (the site is down in this exact moment)

(27 Jul '10, 08:58) Hernani Cerq... ♦♦

i think it may not be somthing you need. but you can use %5C instead of slash

e.g ![](http://latex.codecogs.com/gif.latex?%5Csubset%5Cmathbb{R}^n)

link

answered 27 Jul '10, 12:55

affan's gravatar image

affan
2311714
accept rate: 0%

edited 27 Jul '10, 12:58

1

Yes, but the point is to let the people write the backslash in the edit and then, show in the main text.

I modified the showdown.js and was able to emulate som bbcode with regexp, but after sending it and showing in the main body, the string is shown without being replaced any more.

(27 Jul '10, 17:17) miguidotcom
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×113
×30
×29
×4

Asked: 27 Jul '10, 04:04

Seen: 756 times

Last updated: 13 May '11, 17:24

powered by OSQA