Skip to content

Conversation

@allejo
Copy link
Contributor

@allejo allejo commented Oct 16, 2020

Bump highlight.php to v9.18.1.3, which has two fixes with how splitCodeIntoArray works.

Fixes #189
Fixes #193

@allejo allejo requested a review from westonruter October 16, 2020 15:34
Copy link
Owner

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this post_content:

<!-- wp:code {"language":"java","showLineNumbers":true} -->
<pre class="wp-block-code"><code>public QuoteEntity(
)</code></pre>
<!-- /wp:code -->

<!-- wp:code {"language":"java","showLineNumbers":true} -->
<pre class="wp-block-code"><code></code></pre>
<!-- /wp:code -->

Before

image

There is an error in the markup:

<!-- UnexpectedValueException(0): The given HTML could not be parsed correctly. -->

And there is a warning in the error log:

PHP Warning:  DOMDocument::loadHTML(): Empty string supplied as input in /app/public/content/plugins/syntax-highlighting-code-block/vendor/scrivo/highlight.php/HighlightUtilities/functions.php on line 179

After

image

No warning appears in the log and instead of the HTML comment, we instead get:

<pre class="wp-block-code"><div><code class="hljs language-java shcb-code-table shcb-line-numbers"></code></div></pre>

@westonruter westonruter merged commit 37f44f5 into develop Oct 16, 2020
@westonruter westonruter deleted the hotfix/code-splitting branch October 16, 2020 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected line number appearing on same line Empty code block causes highlight.php warning

3 participants