I want to allow users to edit articles with markdown, and then convert it to HTML for display. I use pagedown to do that. But I want users to be able to edit their articles later, which means sending them the Markdown code after it was converted to HTML, and I don't know what the best way to do that. I had these ideas in mind:
A good example of website that do that is stackoverflow, but I have no idea about the method they are using for this.
Personally, I'd store the markdown only, and cache the generated HTML with something like memcached to speed up rendering on page load.
Generate the HTML from the markdown on page load -> cache it -> then hit the cache for a while after. When you edit it either; invalidate the cache, or re-warm the cache to save the user doing it for you.
The problem is that the db will have to store much more data
How much content do you have? Most applications dealing with human generated content you don't have so many Megabytes of content. Unless you want to rebuild en.wikipedia with about 20 GB;)
And either way you need to store the markdown is useful. Beside storing Markdown & HTML with memcached, look at some static site generators, they all store both by definition.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With