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

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)
pcompassion's avatar
21
pcompassion
asked 11 years ago, updated 11 years ago

Comments

1

To notify Evgeny:

Please take a look at my comments.

pcompassion's avatar pcompassion (11 years ago)
1

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

Evgeny's avatar Evgeny (11 years ago)
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.

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
answered 11 years ago, updated 11 years ago
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 (11 years ago)
1

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

pcompassion's avatar pcompassion (11 years ago)

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 (11 years ago)
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 (11 years ago)

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

pcompassion's avatar pcompassion (11 years ago)
see more comments