First time here? Check out the FAQ!
2

link is displayed correctly in preview but not in actual post

JSON

is shown correctly in preview but not in actual post

(in current git repo)

ie

[JSON][1]

  [1]: http://en.wikipedia.org/wiki/JSON
pcompassion's avatar
21
pcompassion
asked 2013-07-02 06:58:06 -0500, updated 2013-07-03 09:09:31 -0500
edit flag offensive 0 remove flag close merge delete

Comments

1

To notify Evgeny:

Please take a look at my comments.

pcompassion's avatar pcompassion (2013-07-08 22:52:00 -0500) edit
1

Sure, I'll reply tomorrow (Chile time).

Evgeny's avatar Evgeny (2013-07-08 22:53:05 -0500) edit
add a comment see more comments

1 Answer

0

The issue is that we have two markdown converters - one in Python and one in Javascript for the previewer. Both are third party libraries. Maybe there is a way to reduce the difference between the two, but we have not looked at this in detail yet. An alternative is to port implementation of one converter in the other language to replicate the functionalities exactly.

The "raw link" vs clickable link: we have a feature that forces raw link if user's reputation is lower than certain threshold, so we would need to replicate this in the previewer or remove this feature (there is also a feature that will prevent posts with links outright if user has low reputation).

Regarding the two markdown converters I think that in order to fix this issue reliably we should replicate the python markdown converter in JS 1:1...

A little more technical detail:

The Markdown parser we use is from the markdown2 library and it is set up in askbot.utils.markup.get_parser() function.

In addition to using raw markdown2 we do some more things (see functions askbot.models.Post.parse_and_save and askbot.models.post.parse_post_text):

  • "linkify" the @mentions
  • depending on the user reputation either insert full external links or insert them as plain text or reject the post (an antispam feature - we could argue separately whether this is actually a good feature or not)

Javascript converter does one more thing: if Mathjax is enabled it re-runs mathjax upon re-rendering.

So in order to exactly replicate this in the previewer this all has to also be coded in Javascript.

Re: Javascript implementation - we've recently switched to pagedown which was written for StackOverflow. This is a more reliable converter, before we used "showdown.js", but it proved to have XSS issues. AFAIK pagedown is a rewrite of showdown.

It is possible that we can implement the missing features in the previewer by simply configuring the "pagedown" converter - it seems to allow configurable post-processing scripts.

Evgeny's avatar
13.2k
Evgeny
answered 2013-07-03 09:12:37 -0500, updated 2013-07-11 15:07:56 -0500
edit flag offensive 0 remove flag delete link

Comments

1

Since it's very critical to askbot(what's more important than posting a question and reading it as it is supposed), I hope it gets fixed soon. Unfortunately I'm new to markdown/editor/parser in general to fix it fast :(

pcompassion's avatar pcompassion (2013-07-03 19:24:51 -0500) edit
1

list (ordered and unordered) is displayed incorrectly as well..

pcompassion's avatar pcompassion (2013-07-03 21:01:57 -0500) edit

I'm facing the same problem. The link is fine in preview mode but after posting its showing the raw link. Any idea how to solve this? I had only 1 link in my answer and its not coming correctly.

Chankey Pathak's avatar Chankey Pathak (2013-07-04 07:26:23 -0500) edit
1

Evgeny: can you share the current plan for this bug fix? or layout the strategy so that I can work on it?

pcompassion's avatar pcompassion (2013-07-08 17:24:38 -0500) edit

@Evgeny I see they mention using node.js for server side. Is that an option for askbot?

pcompassion's avatar pcompassion (2013-07-08 19:10:32 -0500) edit
add a comment see more comments