Formatted text in GAE

Question with the Google engine: what is a good way to format formatted text (it’s not necessary to be rich text) from the user, and then save it in the text or blog property in the data store? Basically what I'm looking for is to store new lines and lines of spaces so that the text is returned the same as when it was sent.

+3
source share
2 answers

Text will always “come back” the same way you insert it. You will lose some formatting in HTML (as you notice line endings and spaces). One solution might be to convert the text to an element <pre> (which involves preformatted text) .

<pre>
This text     will

be formatted correctly
</pre>

Another way would be to convert your format to HTML, which is well formatted. A wiki can usually do this: save the text as markup and display it in HTML. Probably this particular site works with messaging, etc. If you choose this route, I can recommend the creoleparser library , and it works great on Appengine.

+2
source
+2

Source: https://habr.com/ru/post/1704692/


All Articles