I am working on a project on both iOS/Android/macOS/Linux (Windows is optional, and surely no website version). There are a lot of related webpage-like data and the team decided to store the data in a specific markdown format (not the ordinary *.md format) to meet the requirements in the specific domain being dealt with. The custom markdown files are stored in an online database, and are much more compact than other formats e.g. html in order to save storage space and traffic.

Now, in order for the clients to read the contents, we need to parse the markdowns on either server side or client side. The plan is to convert to html and display it in a web-view on client side. This is a dilemma because of the following:

  1. Sending the data in markdown format saves much traffic since the format was designed to be compact.

  2. Parsing speed is not an issue. Each markdown file is pretty short. Caches will stay on client machines so reparsing is not necessary.

  3. Storing both html versions (as cache) and markdown versions sounds like a waste of storage, and discarding the markdown versions is inconvenient if we need to further edit them.

I am aware of several questions on Stack Overflow which unanimously suggest parsing on server side, but they don't really address my needs. First, parsing is not done in browsers, so no additional libraries will be downloaded. Also, they suggest an initial parse on server side and reparse on client side if the content changes. However, in my case the markdowns are static and users are not allowed to make changes. Furthermore, they are concerning the ordinary markdown format (*.md) instead of a custom format.

The only advantage of parsing on server-side that I can think of is to avoid code duplicate. The mobile versions will be written with Flutter (so core parts are written in Dart). The macOS version will involve some Swift and C++, and the Linux version will involve C++ and possibly some Java for GUI (so that it would be easier to port the product to Windows if needed in future). I know I can write everything in C++ directly, but as of today calling C++ from Flutter is still a pain.

Since this is a much more general situation, I think I need some advice here. Any help is appreciated.

  • any explanation for the downvote? – tonychow0929 Nov 9 at 10:14
up vote 3 down vote accepted

It all comes down to one thing: what are your main concerns with this system? Is it reducing the storage space required? The bandwidth use? The server CPU use? Is the custom markdown something your clients should not be allowed to see the architecture of?

To me it sounds like hiding the fact that you use proprietary markdown is not an issue, nad you clearly stated that the plan was too diminish bandwidth and storage; Therefore, from what youve said you might consider doing the rendering on the client side, but only if your concern for bandwidth and storage are bigger than your concerns with development time.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.