Lines that start with whitespaces break HTML encoding
-
I’m using the 3.7 version on WordPress 6.4.3, and when I try to use the following code block:
[code lang="java" gutter="false" highlight="11-17"] @Entity(name = "Post") @Table(name = "post") public class Post { @Id private Long id; @Column(length = 100) private String title; @Column(name = "published_on") @TimeZoneStorage(TimeZoneStorageType.COLUMN) @TimeZoneColumn( name = "published_on_offset", columnDefinition = "smallint unsigned" ) private OffsetDateTime publishedOn; } [/code]
It is rendered like this:
@Entity(name = "Post") @Table(name = "post") public class Post { <pre><code>@Id private Long id; @Column(length = 100) private String title; @Column(name = &quot;published_on&quot;) @TimeZoneStorage(TimeZoneStorageType.COLUMN) @TimeZoneColumn( name = &quot;published_on_offset&quot;, columnDefinition = &quot;smallint unsigned&quot; ) private OffsetDateTime publishedOn; </code></pre> }
The problem seems to be caused by the new lines that preceed the lines starting with the space characters.
Currently, the only workaround is to add the \x{A0} invisible Unicode character on the new lines that preceed the lines starting with the space characters, like this:
[code lang="java" gutter="false" highlight="11-17"] @Entity(name = "Post") @Table(name = "post") public class Post { ? @Id private Long id; ? @Column(length = 100) private String title; ? @Column(name = "published_on") @TimeZoneStorage(TimeZoneStorageType.COLUMN) @TimeZoneColumn( name = "published_on_offset", columnDefinition = "smallint unsigned" ) private OffsetDateTime publishedOn; } [/code]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Lines that start with whitespaces break HTML encoding’ is closed to new replies.