php - When to process Markdown? -


i have flavored version of markdown implemented in social web application. works, question is: when should convert user input (markdown) html? before storing in database (so html stored in database) or when user requests view (store markdown in database)?

both methods have pros , cons, come following arguments:

  • storing processed input in database makes showing faster, because don't need convert anymore, it's ready display.
  • processing when viewed allows me change markdown processor @ time, example adding feature automatically parses youtube urls embeds.

what approach take , why?

as rule, try store data in least processed state, because might change way it's processed. can recreate processed data, can't recreate original.

what if want add "edit" feature? you'll need markdown.

i'd store markdown , render on demand, putting in cache (which might simple "store both formats in database) if performance might problem.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -