Developer654079525's avatar

Markdown storage

Our cms stores raw HTML in a table. The HTML was written by us and is displayed unescaped as part of a page in multiple routes. The content itself usually contains simple tags, escaped pre code and code content and some Bootstrap styled divs and tags. Some of the divs even utilize the Bootstrap's JavaScript functionality.

A markdown approach seems to be an easier option for editing, although less customizable. What should we do now? Continue with the raw HTML or make an effort to somehow convert that to markdown and continue with a markdown.

The content is around 80-100 records long so far, and the records that contain Bootstrap's JS functionality are around 20 in total.

We are using 3rd party libs on a dedicated machine to export the content to PDF too and that works well.

The speed of writing and editing the articles stored as such is a bit of a pain point for us. There is a decision to be made whether to somehow convert/rewrite the existing HTML to markdown or continue with the HTML. What tools/approach would you suggest?

0 likes
4 replies
martinbean's avatar

@developer654079525 It completely depends on the use case, and who is authoring this content.

Why is there things like JavaScript in content in the first place? I strive to separate content from functionality as much as possible in dynamic websites.

martinbean's avatar

@developer654079525 Can you not extract those instances to some sort of “widget” or “element” in your CMS so you’re not hard-coding details about your presentation layer in your database? Because now you’re stuck if you want to say, change how you want those items displayed (i.e. an accordion rather than “toggles”, or something else entirely); or if Bootstrap changes the class and attributes names for v6, you’re not going to be able to upgrade without lots of copy-and-pasting; or if you want to use something else entirely instead of Bootstrap…

Developer654079525's avatar

We are displaying those elements in a page and expanding them in the print version via CSS. Works out of the box with Bootstrap. Unfortunately, looks like we are stuck with raw HTML for now. To the raw HTML's defense, looks like the markdown approach isn't without its set of limitations either. Think quick edits and nasty new lines conundrums when using 3rd party software to quickly edit the record. Custom class styling limitations and nasty parser outputs too. At this point, it looks like we must continue with the raw html and endure the wyswyg editing pains.

Please or to participate in this conversation.