Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
507 views
in Q2A Core by
I've written a Markdown plugin for Q2A but I've come across an issue with formatting. When any content is posted, Q2A appears to trim the spaces from it before saving it in the database.

This means that if you post some code on the first line (which starts with 4 spaces) it gets trimmed and not picked up as code. Is there a way to preserve those spaces? They don't seem to be present at any stage in the plugin functions.

1 Answer

+1 vote
by
 
Best answer

Good question! I believe the only thing that does trimming is the qa_post_text(...) call that you're probably using in your plugin's read_post(...) function. Take a look at the function in qa-base.php to see how you can make your own version that better suits your needs.

by
Does $_POST get blanked, too? I tried copying the contents of qa_post_text to my plugin but now it comes back with a blank string (or null, probably).
by
$_POST isn't modified by any part of Q2A - print_r($_POST); should confirm that.
by
Ah my bad, I was using `$_POST[$field]` - copied from qa_post_text - instead of `$_POST[$fieldname]` since $fieldname is passed into that function. Sorted now!
...