Reputation: 138
I am using Flutter-Fire stack (Flutter for Frontend and Firebase For Backend) I want to use Markdown Text in my app and data needs to be fetched from Firestore. now When I send data to Firestore using admin or directly paste in the field of Firestore Document then All data mashup means white space got removed and In such a situation data shown by the app is totally different from what I want. I am using this package Markdown screenshots For more Explanation are:
Upvotes: 2
Views: 4018
Reputation: 12373
Store them in Firebase Storage, as .md
files, they'll be downloaded as they are. Just as if you are fetching images or any other blobs, works great. Check it out, documentation here.
Upvotes: 6
Reputation: 1
You can use this approach with firebase by explicitly converting the multiline content using following javascript function as an example, you can easily write it in dart and simply use this function to store content and parse it again whenever required
function multilineToSingleLine(text) {
return text.replace(/\n/g, '#NEWLINE#');
}
function singleLineToMultiline(text) {
return text.replace(/#NEWLINE#/g, '\n');
}
Upvotes: 0