News for hackers. Stuff that matters.
Re:Space After Periods (1993) by simiones on Wednesday July 12, 2023 @05:47AM (#36692292)
It's a bit funny because it's actually hard to represent Python code in regular HTML, exactly because of this collapsing.

For example, here is some Python code typed correctly in the comment box but rendered without the code formatting support (using a | at beginning of line to prevent the code formatting to kick in):

|def foo(flag):

| if flag:

| print("this is indented")

| print("is this?")

If you check the HTML, it looks like this:

  <p>|def foo(flag):</p>
  <p>|    if flag:</p>
  <p>|       print("this is indented")</p>
  <p>|    print("is this?")</p>
Re:Space After Periods (1993) by distcs on Wednesday July 12, 2023 @07:41AM (#36693085)
> it's actually hard to represent Python code in regular HTML

It is not hard. Just use the right tag. You want the <pre> tag here. Here, fixed it for you:

  def foo(flag):
      if flag:
         print("this is indented")
      print("is this?")