Conversation
New Action: `syntax_highlighting_code_block_boot`. This action is run post boot after the `plugins_loaded` action has been executed. This is useful for letting others know when the plugin has finished its boot process in order to modify any early actions and filters the plugin uses.
…highlighting_code_block_injected_markup New filter: `syntax_highlighting_code_block_transient_key` - This is for filtering the language param that's returned. See: westonruter#191 New filter: `syntax_highlighting_code_block_injected_markup` - This is for being able to modify the output before its returned. This is to help those who want to extend the markup or introduce their own.
New action: `syntax_highlighting_code_block_highlighter_init` - Fires in the `render_block` function after the highlighter has been initialized. Helps fix: westonruter#191
…nguage names. Filter: `syntax_highlighting_code_block_language_names` - Resolves issue: westonruter#488
Filter `syntax_highlighting_code_block_injected_markup` is added to the output for the highlighted portion.
Filter: `syntaxHighlightingCodeBlockAttributes` allows you to set defaults for the code block.
Filter `syntax_highlighting_code_block_pre_start_tag` is for adding markup to pre tag and honoring block alignment.
Filter `syntax_highlighting_code_block_code_classes` allows you to add custom classes to the `code` element.
Remove filter `syntax_highlighting_code_block_pre_start_tag` as pre tag is not designed to have extra markup injected.
westonruter
reviewed
Oct 9, 2023
westonruter
left a comment
Owner
There was a problem hiding this comment.
Thanks for the PR! Could you surface the commit messages in which you explain the reasons for the new hooks to be PR description? This will make sure they aren't buried. You can then add the GitHub Closes #... annotations to the description to link the PR to the issues that it closes.
Lastly, for the extension plugin you made, it doesn't seem like you actually need any of the filters you're introducing here. You can just use the render_block_core/code filter to inject your desired markup along with the HTML API introduced in WordPress 6.2.
Author
|
Thanks, will do. I appreciate you checking it out for me.
…On Mon, Oct 9, 2023 at 14:53 Weston Ruter ***@***.***> wrote:
***@***.**** commented on this pull request.
Thanks for the PR! Could you surface the commit messages in which you
explain the reasons for the new hooks to be PR description? This will make
sure they aren't buried. You can then add the GitHub Closes #...
annotations to the description to link the PR to the issues that it closes.
Lastly, for the extension plugin you made, it doesn't seem like you
actually need any of the filters you're introducing here. You can just use
the render_block_core/code filter to inject your desired markup along
with the HTML API
<https://make.wordpress.org/core/2023/03/07/introducing-the-html-api-in-wordpress-6-2/>
introduced in WordPress 6.2.
—
Reply to this email directly, view it on GitHub
<#766 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE3M2MDOMYE7XTMDZ6YGYTX6RI2ZAVCNFSM6AAAAAA5XEDLQKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTMNRVGE3TEMRQGU>
.
You are receiving this because you authored the thread.Message ID:
<westonruter/syntax-highlighting-code-block/pull/766/review/1665172205@
github.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR seeks to add several actions and filters that'll help others extend the block.
Resolves #488 #191
Background
I'd like to add a few addons for this plugin:
I need several filters/actions to do this, hence this PR. I've put together a proof-of-concept of the first addon, which adds a copy button to the code block.
I've done my best to only insert actions/filters where needed. To see examples of some of these in use, please check out my addon code for this plugin: https://github.com/DLXPlugins/syntax-highlighting-code-block-copy-addon/blob/main/syntax-highlighting-code-block-copy-addon.php
Proof of Concept
Please see repo release with attached ZIP files: https://github.com/DLXPlugins/syntax-highlighting-code-block-copy-addon/releases/tag/1.0.0
Thank you for considering this PR.