A
A
Alexander2017-03-03 08:24:55
PHP
Alexander, 2017-03-03 08:24:55

How to store Makdown text in MySQL?

Hello!
Actually a subject.
A field in MySQL is of type TEXT. How can I store Makdown markup in this field?
When simply writing text, paragraphs are lost, i.e. instead of

This text is a paragraph.
This won't be another paragraph, it will join the line above it.
This will be another paragraph, as it has a blank line above it.

we get
This text is a paragraph. This won't be another paragraph, it will join the line above it. This will be another paragraph, as it has a blank line above it.

Of course there is a way to add a tag
br
or a line break character.
But I would like to keep the Makdown markup clean.
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2017-03-03
@cry_san

MySQL itself would hardly lose line breaks in a cell of type TEXT. Most likely you have a problem with saving/displaying data on the PHP side. Please provide code on how you save/display data

M
Melkij, 2017-03-03
@melkij

Markdown is a text format. Means as the text and to save.
Where did you lose the newlines - mysql has nothing to do with it. What they told him to write down, he will write it down, and then he will read it. Maybe you yourself delete line breaks before recording, maybe after. It can be trite to output to a format that is immune to line breaks, for example, in HTML.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question