Ask Your Question
2

link is displayed correctly in preview but not in actual post

asked 2013-07-02 06:58:06 -0600

pcompassion gravatar image

updated 2013-07-03 09:09:31 -0600

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
edit retag flag offensive close merge delete

Comments

1

To notify Evgeny:

Please take a look at my comments.

pcompassion gravatar imagepcompassion ( 2013-07-08 22:52:00 -0600 )edit
1

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

Evgeny gravatar imageEvgeny ( 2013-07-08 22:53:05 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-07-03 09:12:37 -0600

Evgeny gravatar image

updated 2013-07-11 15:07:56 -0600

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.

edit flag offensive delete link more

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 gravatar imagepcompassion ( 2013-07-03 19:24:51 -0600 )edit
1

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

pcompassion gravatar imagepcompassion ( 2013-07-03 21:01:57 -0600 )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 gravatar imageChankey Pathak ( 2013-07-04 07:26:23 -0600 )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 gravatar imagepcompassion ( 2013-07-08 17:24:38 -0600 )edit

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

pcompassion gravatar imagepcompassion ( 2013-07-08 19:10:32 -0600 )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

Stats

Asked: 2013-07-02 06:58:06 -0600

Seen: 209 times

Last updated: Jul 11 '13