8

When I'm editing something in the Android app (Or writing an answer / question), and I tap the "preview" button in the top bar, it sends my markdown to SE servers to be rendered to HTML before showing that to me as the preview.

I think that it should generate the preview locally, on the device, just like on desktop.

This would result in improved performance (no need for a round trip to the server), as well as reduced server load.

There are various Java libraries for processing markdown into HTML, so it should not be too difficult, development-wise.

1
  • Just for the record, v1.0.78 (beta) still need to send the markdown to SE server for previewing. Other alternative is to embed their JS markdown parser since the app is already using their customized WebView. Commented Jan 5, 2016 at 3:04

1 Answer 1

2

I agree with you, but honestly it's just too complex and not worth the effort. We need the preview to be an exact match of what it'll actually look like, and re-implementing our customized Markdown engine is a huge task.

There are many Java libraries to help with this (I at one point had a branch of our codebase that heavily used Bypass) but it's just not the same as the engine that the websites use.

My actual dream for this is to have all posts that don't require WebViews to render the markdown via Bypass natively (so posts that don't need syntax highlighting or MathJax), and if we end up doing that at some point I'll definitely make it work for the preview too, but I've wanted to do that for years and there's a lot of problems with the idea.

1
  • 1
    Definitely agree that there are more important things to do than this, was just throwing it out as an idea. Something mentioned in the comments was to render the markdown for the preview using the same JavaScript as the desktop site preview, ie. pass the markdown to the WebView and then generate the HTML to show using JavaScript, similar to what happens on desktop. That way you reuse the JS used on dektop, and avoid porting the SE markdown parser to java. Just an idea in case you ever decide to do this. Showing posts without using WebView sounds awesome, keep up the good work ! Commented Jan 5, 2016 at 20:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .