V
V
Valeriu Vodnicear2019-10-08 16:26:21
PostgreSQL
Valeriu Vodnicear, 2019-10-08 16:26:21

What is the best way to store content in a database: HTML vs MarkDown?

There is a very large database of articles.
They are now in html format.
Right now we are moving to PostgreSQL, and the idea arose to store text in markdown.
The question is, will this be useful?
Right now articles occupy ~500GB.
If we transfer everything to markdown, will they take up less space in the database?
When issuing the text of the article on the site, how to convert Markdown to HTML?
Is this process done on the server? If so, is this a big load on the server? (the site is quite visited)
If on the client, how will search engines react to this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
FanatPHP, 2019-10-08
@vodnicear

Since people get to the post from the search by title, we will discard the author’s insignificant problems with his current project and answer the question that he put in the title:
Definitely MarkDown .
Html is a horror that needs to be validated, re-validated, formatted and reformatted for every sneeze. You can only edit in the editor. Swapping one tag for another is a headache for many hours.
Markdown is easy to read, beautifully edited, quickly converted.
There is not even a question of what to use - petrified mammoth excrement or a brand new iPhone.

S
shai_hulud, 2019-10-08
@shai_hulud

> and the idea came up to store the text in markdown.
And the solution how to convert to MD has already been found and does it work on all articles?
> The question is, will this benefit?
> If we transfer everything to markdown, will they take up less space in the database?
It's worth checking with whatever conversion solution you have. Usually takes up less space.
> When displaying article text on a website, how do I convert Markdown to HTML?
By writing the conversion code from MD to HTML. On server.
> If so, is this a big load on the server? (the site is quite visited)
In any case, no one in their right mind will serve HTML directly from the database, for anyone there is a preemptive cache on priorities in which this HTML lives and is distributed to people. So the HTML->MD conversion will not happen every request.
If done on the client, search engines will see plain text, not markdown, MD is very similar to plain text, so there will be no tragedy. But it does not have formatting (headings, paragraphs) understandable for search engines, so it will be like a mess of text for them.

N
Northern Lights, 2019-10-08
@php666

The question is, will this be useful?
no
, any markup is created only to enable text formatting to external users.
figuratively speaking, that would not spoil.
for administrative staff it is necessary to give the opportunity to use html, it is many times more flexible than any markup.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question