• Resolved vladmihalcea

    (@vladmihalcea)


    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 = &amp;quot;published_on&amp;quot;)
    @TimeZoneStorage(TimeZoneStorageType.COLUMN)
    @TimeZoneColumn(
        name = &amp;quot;published_on_offset&amp;quot;,
        columnDefinition = &amp;quot;smallint unsigned&amp;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)
  • Thanks for taking the time to report a possible issue with how SyntaxHighlighter Evolved is rendering text.

    Testing this out myself I’ve copied your code into my test site, which has no other plugins active, and the default WordPress theme, Twenty Twenty-Four active.

    It rendered as expected in my tests, with the code you gave me added to a shortcode block:

    (Image link: https://d.pr/i/OjLKGQ )

    Showing like this on my site:

    (Image link: https://d.pr/i/1VkwyR )

    This indicates that there is something in your site’s setup, either a plugin or your theme, conflicting with SyntaxHighlighter Evolved. If you’re never done a conflict test before, this guide will walk you through the process to see which is the cause: https://jetpack.com/support/troubleshooting-plugin-and-theme-conflicts/

    Thread Starter vladmihalcea

    (@vladmihalcea)

    Thanks for the info.

    You’re welcome! ??

    I’m going to mark this thread as solved. If you have any further questions or need more help, you’re welcome to open another thread here. Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Lines that start with whitespaces break HTML encoding’ is closed to new replies.