Skip to content

Conversation

@westonruter
Copy link
Owner

Fixes #194.

Given this post_content:

<!-- wp:code {"highlightedLines":"2"} -->
<pre class="wp-block-code"><code>if ( a &lt; b ) {
   alert( 'A is less than B!' );
}</code></pre>
<!-- /wp:code -->

This renders as a Code block that looks like this:

image

If then this new PHP filter is added:

add_filter( 'syntax_highlighting_code_block_styling', '__return_false' );

Any styling is omitted from being added to the frontend:

image

It's then up to the developer to add the required styling.

This will also prevent adding the Customizer controls for styling, while also moving them to the bottom when they are enabled.

Before After Styles Turned Off
image image image

Copy link

@grgar grgar left a comment

Choose a reason for hiding this comment

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

Fantastic thank you, not that I was the original issue creator but I can stop the deleting random lines in the plugin locally after updating each time to achieve this 👍

@westonruter westonruter merged commit 1b572ab into develop Oct 29, 2020
@westonruter westonruter deleted the add/style-filter branch October 29, 2020 19:04
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.

Add option to remove styles from front-end

4 participants