Sunday 15 March 2015

javascript - What is the best way to store a field that supports markdown in my database when I need to render both HTML and "simple text" views? -


I have a database and I have a website front end, there is a field in front of me that is now text but I am trying to explain the right to store in my database because I have to support various ideas (PDF reports, web pages, excel files etc.)?

My concern is that do not support HTML from those scenes, I just do not have to do HTML version of this area.

Should I store 2 copies (one text only and one HTML?), Or I should store HTML and try to delete HTML tags on them when I rendered in Excel for example Am I

I need to understand the correct format (or format) to store in the database so that both can be present

  • I do not want to go wrong. My point is that I have my own Excel output I do not want to show any HTML tags or markdown syntax.

    decide as:

    1. Basic data (with markdown Text).
    2. Generate derived data (HTML and plain text) on the fly.
    3. Remedy Display:
      • If it is acceptable, then you are, woohoo!
      • If not, cache derived data.

        Caching can be done in many ways ... you can generate instant generated data, and store it in the database, or you can Initially, tap the shops and generation lazy (when and if need it). You can also cash it out of the database.

        But whatever you do, make sure that the cash is never "stale" - that is, when the original data changes, the derivative data in the cache should be regenerated or at least somehow One way to do this as "dirty" is through a trigger.

  • No comments:

    Post a Comment