Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New code blocks are not rendering well + missing line numbers #556

Closed
sandeepdass007 opened this issue Mar 7, 2022 · 8 comments
Closed

Comments

@sandeepdass007
Copy link

My wordpress version is 5.9.1 and Syntax-highlighting Code Block (with Server-side Rendering) version is 1.3.1

Now, preview is very weird, no line numbers (even though i checked the flag in the editor). Old previews are still working fine but new ones are not.

image

@sandeepdass007
Copy link
Author

sandeepdass007 commented Mar 7, 2022

I observed that in new code there is missing <noscript></noscript> and <style></style> tags just above the <code></code>. As a workaround i added all those styles in my theme css editor and working fine but i expect you guys to fix it asap.

@westonruter
Copy link
Owner

This may be a duplicate of #286. Do you have any table of contents plugin?

@sandeepdass007
Copy link
Author

No, i am not using any such plugin

@westonruter
Copy link
Owner

westonruter commented Mar 7, 2022

I can't reproduce this issue.

In the Twenty Twenty theme, with the following post_content content:

<!-- wp:paragraph -->
<p>Line numbers no wrapping:</p>
<!-- /wp:paragraph -->

<!-- wp:code {"highlightedLines":"2,4,6","showLineNumbers":true} -->
<pre class="wp-block-code"><code>&lt;html lang="en"&gt;
&lt;mark&gt;This is highlighted
but not this, but the next line is:
&lt;/mark&gt;
&lt;script&gt;
document.write('Hello World! This line should be highlighted even when it wraps to the next line.');
&lt;/script&gt;
&lt;/html&gt;</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Line numbers with wrapping:</p>
<!-- /wp:paragraph -->

<!-- wp:code {"highlightedLines":"2,4,6","showLineNumbers":true,"wrapLines":true} -->
<pre class="wp-block-code"><code>&lt;html lang="en"&gt;
&lt;mark&gt;This is highlighted
but not this, but the next line is:
&lt;/mark&gt;
&lt;script&gt;
document.write('Hello World! This line should be highlighted even when it wraps to the next line.');
&lt;/script&gt;
&lt;/html&gt;</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>No line numbers:</p>
<!-- /wp:paragraph -->

<!-- wp:code {"highlightedLines":"2,4,6"} -->
<pre class="wp-block-code"><code>&lt;html lang="en"&gt;
&lt;mark&gt;This is highlighted
but not this, but the next line is:
&lt;/mark&gt;
&lt;script&gt;
document.write('Hello World! This line should be highlighted even when it wraps to the next line.');
&lt;/script&gt;
&lt;/html&gt;</code></pre>
<!-- /wp:code -->

Editor:

image

Frontend:

image

What theme are you using? It could be a theme compatibility problem.

@westonruter
Copy link
Owner

If you want to test with the latest 1.3.2-alpha pre-prerelease build you may try that as well: syntax-highlighting-code-block.zip

@sandeepdass007
Copy link
Author

I am using Hoot Porto theme. If it is theme based issue then it should not be working at all. It is working for old published posts but not for new ones

@westonruter
Copy link
Owner

Since that's a commercial theme, I can't test it. If you switch to a core theme, does the issue still happen? In any case, as you can see from my screenshots above I cannot reproduce the issue. I suggest using the Health Check & Troubleshooting plugin to isolate where the conflict lies.

@westonruter
Copy link
Owner

I'm guessing this will be fixed by #785.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants