6

Note: The problem looks similar to this one and was indeed closed as a duplicate, but in that question the formatting in the preview is also wrong; here the preview is displayed correctly, but after publish it is wrong, so there seems to be a difference between the Markdown JavaScript for preview and for display.

This question here - let's see if I can reproduce here too:

1.

for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
{
 ans+=mp[A[i]+B[j]]; // did this because, if A[i]+B[j] doesn't exist, mp[A[i]+B[j]]=0.
}
  1. for(int i=0;i<n;i++) for(int j=0;j<n;j++) { auto it=mp.find(A[i]+B[j]); if(it!=mp.end()) ans+=mp[A[i]+B[j]]; }

This looks fine in preview or if you edit, but the second code block doesn't get formatted on display.

5
  • 1
    Have you tried GitHub code blocks? Might be a temporary fix Commented Dec 18, 2020 at 2:23
  • @andrewtweber Indeed, that does fix it.
    – Ken Y-N
    Commented Dec 18, 2020 at 2:33
  • 1
    If you want a proper code block and a proper numeration, then you need 8 whitespaces not just 4.
    – Tom
    Commented Dec 18, 2020 at 2:40
  • 2
    @Tom This is slightly different as the preview on editing looks OK here, but it's mucked up on publish - the linked example looks wrong on preview too.
    – Ken Y-N
    Commented Dec 18, 2020 at 2:50
  • The same thing happened with a post that I edited a few days ago. Good preview, bad published version. It also involved code blocks in a list. Commented Dec 18, 2020 at 17:29

0

You must log in to answer this question.

Browse other questions tagged .