First time here? Check out the FAQ!

Revision history  [back]

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.

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.

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)

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.

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...

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.yet.