Pomax / EasyPageComments

A simple instant-comments-section for pages based on PHP at the server, and _optionally_ JavaScript at the front end
17 stars 11 forks source link

Preserve spaces in comments #10

Closed PageNotes closed 11 years ago

PageNotes commented 11 years ago

The display mechanism turns comments into HTML, and in the process, in effect, replaces multiple spaces with single spaces, which is bad for displaying code. I fixed this by replacing line 394 with the following:

  $html .= "\t\t<div class=\"EPC-entry-comment\">" . str_replace(" ", "&nbsp;", str_replace("\n","<br/>",$data['body'])) . "</div>\n";
Pomax commented 11 years ago

hm, for code it would make more sense to update this thing to accept markdown instead of just plaintext, so you can do code blocks with a backtick section (like on github). I'll merge this in, but it'll be better to avoid &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when you really only need 8 spaces.

PageNotes commented 11 years ago

Yes indeed. I have withdrawn my suggestion. The very first person to comment didn't put in any hard carriage returns. The result was that the comment caused my right margin to move out /a lot/!

Thanks for your quick response!

On 8/4/2013 11:37 AM, Mike Kamermans wrote:

hm, for code it would make more sense to update this thing to accept markdown instead of just plaintext, so you can do code blocks with a backtick section (like on github). I'll merge this in, but it'll be better to avoid |        | when you really only need 8 spaces.

— Reply to this email directly or view it on GitHub https://github.com/Pomax/EasyPageComments/pull/10#issuecomment-22073613.