Vadorequest
Vadorequest

Reputation: 18009

Format in markdown server or client side? nodejs

I want to use markdown in a website, I'm wondering about convert markdown to HTML client side or server side. I'll use https://github.com/evilstreak/markdown-js that has both client/server libraries. (node.js)

I never used markdown before and I'm wondering about the efficience of the two ways, the security too, because I don't want to have html tags from users (injections)

Do you have any advice or explanation about why do it client side or server side? Thanks.

Upvotes: 2

Views: 1373

Answers (1)

alex
alex

Reputation: 12275

If you're looking for efficiency, you should use the same module to render at both server-side and client-side.

Server side rendering is needed for initial request, and if your data is updated somehow by user, it needs to be re-rendered at the client-side.

Reasons:

  • client-side rendering is too slow for initial request because user needs to fetch all libraries first
  • server-side rendering is too slow for using after the page is loaded because it needs additional requests

Upvotes: 5

Related Questions