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

Introduce filter which disables frontend styling #212

Merged
merged 2 commits into from
Oct 29, 2020

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
3 participants