SyntaxHighlighter TinyMCE Button Plugin
"SyntaxHighlighter TinyMCE Button" provides buttons for Visual Editor and will help to type <pre> tag for SyntaxHighlighter.
“SyntaxHighlighter TinyMCE Button” provides additional buttons for “Visual Editor(TinyMCE)” and these buttons will help to type or edit <pre>
tag for Alex Gorbatchev’s SyntaxHighlighter.
This plugin is based on “CodeColorer TinyMCE Button” and becomes more feature-rich.
Features
- You can operate in Visual Editor, No need to use HTML Editor.
- Using two buttons, easy to wrap your code in
<pre>
tag and change options of previously-wrapped code. - Once your code is wrapped in
<pre>
tag, You can type ‘tabs’ for indent. - Localization: English(Default), 日本語(Japanese, UTF-8).
Compliant plugins
You can use this plugin with following code syntax highlighter.
When using with “SyntaxHighlighter Evolved”, “Load All Brushes” option must be enabled on the “SyntaxHighlighter” setting panel.
This plugin has operating modes optimized for “WP SyntaxHighlighter”, “Syntax Highlighter Compress” or “SyntaxHighlighter Evolved”.
Notes
This plugin can work only with the default visual editor(TinyMCE). Other visual editors are not supported.
This plugin is designed to work with a plugin based on Alex Gorbatchev’s SyntaxHighlighter Ver, 2.0 or higher.
You can not use this plugin with some ‘SyntaxHighlighter’-based plugins which do not support <pre>
tag.
Installation
Installation
- Upload plugin folder to the
/wp-content/plugins/
directory. - Activate the plugin through the “Plugins” menu in WordPress.
- If you need, go to “Settings” -> “SH TinyMCE Button” to configure.
If you use “WP SyntaxHighlighter“, “Syntax Highlighter Compress” or “SyntaxHighlighter Evolved“, you should configure “Using with” option on the setting panel.
Usage
Usage: To paste your code into the post or page.
If you want to paste the code from the other document into your post or page, this way is best. Your pasted code will be warpped in <pre>
tag automatically.
- Click “CODE” button.
- Select language and options and paste your code into textbox.
- Click “Insert” button.
Usage: To wrap previously-written code in <pre>
tag.
If you have previously-written code on your post or page, by this way, you can wrap your code in <pre>
tag for ‘SyntaxHighlighter’.
- With the mouse, select and highlight your code where you want to aplly “SyntaxHighlighter”.
- Click “pre” button.
- Select language and options.
- Click “Insert” button.
Usage: To change language and options of previously-markuped code.
- With the mouse, select and highlight your code.
- Click “pre” button.
- Change language and options.
- Click “Update” button.
Usage: To indent by tabs.
- Just type tab in your code. But till your code is wrapped in
<pre>
tag, you can not type any tabs.
Screenshots
This is added buttons on TinyMCE.
This is pop up window at the click of "pre" button.
This is pop up window at the click of "CODE" button.
This is setting panel.
FAQ
Q. I want to change language and options of previously-markuped code with “pre” button. But I can’t select whole my code.
A. You need not to select whole your code. It’s enough to select first line of your code.
Q. After the update to new version, Buttons do not work correctly.
A. Old javascript files may be cached. Please clear your browser’s cache or delete cached javascript files.
Q. I get errors trying to check “html-scripts box”.
A. “html-scripts” option requires “XML” brush. However, some ‘SyntaxHighlighter’-based plugins do not load “XML” brush by default. If you want this optiin, you should consider the use of “WP SyntaxHighlighter“.
Changelog
0.7.8.4
- Fix a bug: Can’t change “Using with” option.
0.7.8.3
- Fix a bug: Using bloginfo() in the wrong way.
- Fix a bug: A missing textdomains.
0.7.8.1
- Fix a bug: TinyMCE “code” button can’t handle sourcecodes including HTML entities(
&
, <
, >
, "
, '
😉 correctly.
0.7.8
- Rewritten the codes for array definition.
- Changed setting data migration process.
- Fix a bug: When using code button, some browsers give extra line break.
0.7.7
- Validating the setting values more closely.
- Added the icon before title block on the setting panel.
- Fix a bug: The setting data migration processing can’t work concurrently with auto-update.
- Fix a bug: A error message don’t be translated.
0.7.5
- Support WP SyntaxHighlighter ver. 1.5.5 or higher.
- Checking if the current request carries a valid nonce when settings are saved or reset.
- Validating the setting value before saved.
- Changed line feed codes to LF.(except text files) The line feed codes were CR/LF in the many of files.
- Changed the method of displaying the notice message for admin.
- Changed the processing method when plugin is updated.
- Using dirname() and plugin_basename() instead of hardcoded directory name.
- Changed directory name stored translation files.
0.7.2
- Fix a bug: “Insert” function of “pre” button does not work in the fullscreen mode.
0.7.1
- New fullscreen mode in WordPress 3.2 or higher was also supported.
0.7
- Added the “Dafault languages settings for your buttons” options.
- Added “Reset All Settings” button into the setting panel.
- All setting value are stored in the associative arrays.
- Changed processing code for creating buttons.
- Changed the method to add javascript into setting panel.
0.6
- Added the option to choose pop-up windows size.
- Changed the method to get plugin directory url.
- “Secondary mode” is fully integrated into “Normal mode” and removed.
0.5.7
- Changed the method to get plugin directory url.
0.5.6
- Removed “sh-tinymce-button-ins-2nd.php” and “sh-tinymce-button-box-2nd.php”.
- “Secondary mode” integrated into “Normal mode”.
- Changed the method to get plugin directory url in “Secondary mode”.
0.5.5
- Fix “Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.” when “WP_DEBUG” is turned on.
- Added “System Info” in setting panel.
- Changed processing code for “Secondary mode”.
0.5
- Can choose TinyMCE toolbar row which buttons will be placed in.
- New operating modes optimized for “SyntaxHighlighter Evolved“.
- Added “Secondary mode” for troubleshoot.
- Changed processing code for creating buttons.
0.4.1
0.4
0.3
- Added new options to popup window at the click of “pre” and “CODE” button.
0.2.2
0.2.1
- Simplified codes related to processing tabfocus.
- Modified Japanese translation(modified “shtb_adv_lang-ja.mo” file).
- Translation of button labels on TinyMCE popup window has been completed.
- layout of buttons on TinyMCE popup window has been changed.
0.2
- Added “CODE” button which allows to paste sourcecode into post or page, keeping indent by tab.
- Enable to change language and options of previously-markuped code.
0.1.1
- This is the first version.