svivian / q2a-markdown-editor

Markdown editor plugin for Question2Answer
55 stars 24 forks source link

Problem with underscore and italic with certain variable names. #7

Closed pierrepaullavoie closed 10 years ago

pierrepaullavoie commented 11 years ago

Some questions use names such as Foo_Bar. If the name occurs twice pagedown seems to detect it as an italic directive.

This sentence:

Lorem Foo_Bar is Foo_Bar ipsum.

will look like

Lorem Foo Bar is Foo Bar ipsum.

without the space preceding the first Bar and succeeding the second Foo.

For example. Github flavored markdown does not allow for starting italic mid-word using this syntax.

It is possible to correct this behavior (not allow starting italic mid word and end it mid word) or disable the underscore as an italic operator?

svivian commented 11 years ago

You could do either of these:

I am probably not going to change this behaviour. If you want to do it yourself you'd have to check through the inc.markdown.php file for where the underscore is converted.

pierrepaullavoie commented 11 years ago

Thanks for the reply! We already use those workarounds. I did look at inc.markdown.php and was wondering if the right place for the change would be around line 985 $em_relist? Should I simply remove the array entry or perhaps change the regexp to match the star character a second time?

One additional inconvenience is that, if I recall correctly, the markdown preview and PHP outputs do not match.

svivian commented 11 years ago

OK I will leave this open for now until I can check into it properly.

costasdroid commented 9 years ago

This is a very common issue. For the workaround, I found two regex of replacing the proper string. One inside inc.markdown.php and the other inside Markdown.Converter.js. By changing both or one at the time neither of them worked.

I have a major problem with my math notations. Of course I can use \_ every time, but I have already wrote a whole bunch of exercises without the escape \. Can you at least point out what to change in what file in order to bypass _ midword as @pierrepaullavoie mentioned?