code-prettify icon indicating copy to clipboard operation
code-prettify copied to clipboard

Add a couple of hooks

Open certainlyakey opened this issue 8 years ago • 2 comments

Thanks for the great plugin!

I understand that you want to keep the plugin simple but maybe from developer's point of view it would be really useful if we could have a couple of hooks available for this plugin:

  1. one that would allow to modify the detected pre/code tags content (for example, wrap them in another tag or do search/replace operations);
  2. another that would allow to change the prettyprinted class to something other.

certainlyakey avatar Jun 01 '17 13:06 certainlyakey

Thanks for the suggestions @certainlyakey! I'm happy to add any hooks that you would find useful.

allow to modify the detected pre/code tags content

I'm not sure if the Prettify library supports that. Can you please look into that?

allow to change the prettyprinted class to something other.

The only issue with that is the CSS styles that come with this plugin -- they would stop working, I think. Secondly, I'm not sure if Prettify supports that.

kasparsd avatar Jun 01 '17 14:06 kasparsd

Thanks for the reply @kasparsd! I see now that I was a bit too fast to submit an issue.

  1. Actually it seems we can use the Google's prettify's Javascript callback via script URL argument — and the script URL is already conveniently passed through a filter so this one should not be any problem.
  2. Here the prettyprinted class that the plugin adds into WP output has confused me — in the Google's code-prettify docs it's said that the class will be prettyprint so I've thought that you change it somewhere. And it seems that the class is hardcoded, so no way around that, even though I still don't understand about the varying classes names thingie. Regarding the CSS styles — it seems they make no use of the prettyprinted/prettyprint class name, so this would not become a trouble probably.

certainlyakey avatar Jun 01 '17 15:06 certainlyakey