plugin:syntaxhighlighter3
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:syntaxhighlighter3 [2016-01-11 23:57] – [Conflict with Ace Editor [FIXED]] 104.33.1.96 | plugin:syntaxhighlighter3 [2023-10-30 23:19] (current) – Klap-in | ||
---|---|---|---|
Line 3: | Line 3: | ||
---- plugin ---- | ---- plugin ---- | ||
description: | description: | ||
- | author | + | author |
- | email : Not supplied | + | email : bd.dali@gmail.com |
type : Action, Syntax | type : Action, Syntax | ||
- | lastupdate : 2013-08-07 | + | lastupdate : 2018-02-09 |
- | compatible : 2009-02-14 2009-12-25 2010-11-07 2011-05-25 2012-01-25 2012-10-13 2013-05-10 2013-12-08 2014-05-05 2014-09-29 2015-08-10 | + | compatible : Lemming, Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Hrun, Detritus, Elenor of Tsort, !Hogfather |
depends | depends | ||
- | conflicts | + | conflicts |
similar | similar | ||
tags : code, syntaxhighlight, | tags : code, syntaxhighlight, | ||
- | downloadurl: | + | downloadurl: |
- | sourcerepo: https:// | + | sourcerepo: https:// |
- | bugtracker: | + | donationurl: https:// |
+ | |||
+ | screenshot_img: | ||
---- | ---- | ||
- | ===== Download and Installation ===== | ||
- | |||
- | :!: Github handles single file downloads differently now so the old download URL is no longer correct, uninstall old plugin (installed before 2013-08-07) and install again using new download URL above. | ||
- | |||
- | Download and install the plugin using the [[plugin: | ||
- | |||
- | The subfolder sxh3 contains a complete (and untouched) distribution of SyntaxHighlighter 3.0.83. | ||
- | |||
- | ===== Syntax and Usage ===== | ||
- | |||
- | Client-side syntax highlighter (with copy to clipboard functionality) based on [[plugin: | ||
- | |||
- | * Updated to use version 3.0.83 of [[http:// | ||
- | * Does not use < | ||
- | * Does not require Flash for copy to clipboard functionality. | ||
- | |||
- | Update 2011-06-07: | ||
- | |||
- | * Plugin adapted to [[: | ||
- | * Uses Autoloader instead of always loading all brushes on all pages. | ||
- | * Uses [[: | ||
- | * Add support for block title attribute. | ||
- | |||
- | Update 2013-08-07: | ||
- | |||
- | * Fixed problem with the option html-script, | ||
- | * Convert brush aliases and options to lowercase, SyntaxHighlighter is case sensitive. | ||
- | |||
- | :!: Github handles single file downloads differently now so the old download URL is no longer correct, uninstall old plugin and install again using new download URL above. | ||
- | |||
- | |||
- | Usage:\\ | ||
- | <code text> | ||
- | <sxh [brush alias][; options for SyntaxHighlighter]> | ||
- | ... code/text ... | ||
- | </ | ||
- | </ | ||
- | |||
- | **//brush alias//** - The brush alias (language) that SyntaxHighlighter should use. Defaults to " | ||
- | \\ | ||
- | **// | ||
- | |||
- | Example: | ||
- | <code text> | ||
- | <sxh php; first-line: 70; highlight: [89,92]; title: New title attribute in action> | ||
- | public function render($mode, | ||
- | | ||
- | if($mode != ' | ||
- | |||
- | if (count($data) == 3) { | ||
- | list($syntax, | ||
- | if ($syntax == ' | ||
- | // Check if there' | ||
- | if (preg_match("/ | ||
- | // Extract title(s) from attribute string. | ||
- | $attr_array = explode(";", | ||
- | $title_array = preg_grep("/ | ||
- | // Extract everything BUT title(s) from attribute string. | ||
- | $not_title_array = preg_grep("/ | ||
- | $attr = implode(";", | ||
- | // If there are several titles, use the last one. | ||
- | $title = array_pop($title_array); | ||
- | $title = preg_replace("/ | ||
- | // Add title as an attribute to the <pre /> tag. | ||
- | $renderer-> | ||
- | } else { | ||
- | // No title detected, pass all attributes as parameters to SyntaxHighlighter. | ||
- | $renderer-> | ||
- | } | ||
- | } else { | ||
- | $renderer-> | ||
- | } | ||
- | } | ||
- | |||
- | return true; | ||
- | } | ||
- | </ | ||
- | </ | ||
- | |||
- | Expected result (this is a **screenshot image**, copy to clipboard will not work):\\ | ||
- | \\ | ||
- | {{http:// | ||
- | ==== Copy to clipboard ==== | ||
- | |||
- | Double click anywhere inside SyntaxHighlighter code area to highlight the text and then copy it using Ctrl/Cmd+C or mouse right click -> Copy. | ||
- | |||
- | Click outside the code area to restore highlighting. | ||
- | ===== Issues ===== | ||
- | |||
- | ==== Box Shadow with latest template / theme ==== | ||
- | |||
- | I've noticed that the latest template / theme for dokuwiki add's a box shadow around normal code blocks \\ | ||
- | I think it's the Adora Belle theme | ||
- | |||
- | This has the affect of adding a box shadow around small bits of code shown via syntax highlighter | ||
- | |||
- | The fix I've found is just to add the following line to **shCore.css** within **" | ||
- | < | ||
- | box-shadow: none; | ||
- | </ | ||
- | ==== Option html-script is not working [FIXED] ==== | ||
- | The html-script option is not working. | ||
- | For example in this simple example the div isn't syntaxhighlighted: | ||
- | |||
- | < | ||
- | <sxh php; html-script: | ||
- | < | ||
- | <?php | ||
- | public function render($mode, | ||
- | |||
- | if($mode != ' | ||
- | } | ||
- | ?> | ||
- | </ | ||
- | </ | ||
- | |||
- | > | ||
- | > Should be fixed now. Remove plugin and install again with download link above, github handles single file downloads differently now so the old URL is no longer correct. | ||
- | |||
- | ==== Conflicts with Search highlighting [Core DW issue, not fixable]==== | ||
- | |||
- | If you trigger a search e.g. " | ||
- | |||
- | > | ||
- | > Yep, the search function seems to insert HTML tags into the code block at each hit. | ||
- | > Don't know if I can do anything about that, the search is done server-side so the HTML code that reaches SXH (client-side) already has the highlighting tags inserted. | ||
- | >> | ||
- | >> According to a very skilled DW dev it is a core DW issue and quite difficult to fix: http:// | ||
- | >> | ||
- | >> Link to related bug report in case the gmane link stops working: https:// | ||
- | >> | ||
- | >> I can't do much about it in the plugin. | ||
- | ==== Conflicts with ' | ||
- | |||
- | This plugin conflics badly with " | ||
- | |||
- | > I've added [[: | ||
- | > | ||
- | > I suggest that you try [[: | ||
- | |||
- | |||
- | ==== Toolbar [Incorrect] ==== | ||
- | |||
- | < | ||
- | > | ||
- | >Wrong. The "ugly green ?" **is** the toolbar, which you can turn off (hide) by adding " | ||
- | > | ||
- | |||
- | |||
- | ==== Validation error [FIXED] ==== | ||
- | |||
- | Only when I enabled this plugin, I get this error at [[http:// | ||
- | for type are type=" | ||
- | > | ||
- | >Should be fixed now, please download plugin again (you can use plugin manager). | ||
- | > | ||
- | |||
- | ==== Conflict with Ace Editor [FIXED] ==== | ||
- | |||
- | I like this plugin! nice job | ||
- | There is a small conflict with the [[plugin: | ||
- | > | ||
- | >Yep, there seems to be a conflict. I've contacted the author of the Ace Editor plugin, hopefully we will find a solution. | ||
- | > | ||
- | >> | ||
- | >> The conflict has been resolved, all credit goes to Albert Gasset who updated Ace Editor plugin with a workaround. | ||
- | |||
- | |||
- | ==== Double-click to copy doesn' | ||
- | When a block is double-clicked in firefox (on linux), the selection expands to the entire block, but a subsequent copy (whether ctrl-c or right click - copy) only copies the text (word) that would be selected by the double-click. This behavior seems to work fine in chromium | ||
- | ===== Feature Request ===== | ||
- | |||
- | ==== Hides table of contents ==== | ||
- | How can I that? | ||
- | ==== Title [FIXED] ==== | ||
- | |||
- | This plugin renders beautifully! | ||
- | If possible it would be nice to have a title at the top of the code block like the default %%< | ||
- | -- Jeff | ||
- | > | ||
- | > Hmmm, there is the [[http:// | ||
- | > Might be doable, I'll add it to the todo-list for when I have the time and energy to update the plugin. Could be a while. | ||
- | >> | ||
- | >> Should be fixed now, remove old version of plugin and install again using download link above. | ||
- | |||
- | ==== showing code from external file [Not possible] ==== | ||
- | |||
- | I would like to use this plugin for highlighting and showing code from a file I have uploaded via mediamanager into a data/ | ||
- | Could it be possible to patch or enhance this plugin to do this? < | ||
- | > | ||
- | > Don't think it's possible, the plugin only deals with the wiki code, not external files. | ||
- | |||
- | ==== remove toolbar [Prefer not to implement] ==== | ||
- | |||
- | Since in last version toolbar is not used more, is it possible to disable it by default? < | ||
- | |||
- | > Modified shCore.js without toolbar : [[http:// | ||
- | > | ||
- | >> | ||
- | >> I prefer to leave SyntaxHighlighter files and functionality untouched. Makes troubleshooting and maintenance easier. | ||
- | >> | ||
- | >> I have considered adding a config setting for default options, but haven' | ||
- | >> | ||
- | >> There' | ||
- | |||
- | ==== DW2PDF support [Not possible] ==== | ||
- | |||
- | Is there any way to have dw2pdf supported? < | ||
- | |||
- | > | ||
- | > dw2pdf looks like a great plugin. Unfortunately I don't believe it's possible to use it with SyntaxHighlighter. | ||
- | > | ||
- | > SyntaxHighlighter renders it's output locally in the web browser on the client (i.e. " | ||
- | > | ||
- | >To have them interact, they both need to be either client-side or server-side. | ||
- | > | ||
- | ==== Copy Trailing Newline ==== | + | :!: **[[: |
- | Is it possible to also copy a trailing newline if included in the sxh block? The double-click to select block is great, but I can't figure out how to include a newline at the end of the last line of the block. Clippy allows this. Of course, clippy is very different and requires flash, so perhaps not a good example. | + | |
- | ===== Plugin structure | + | ===== Download, install, usage, examples... |
- | These files and directories are included in the plugin: | + | All information about download, install, usage, syntax, examples |
- | <code text> | + | |
- | syntaxhighlighter3 | + | |
- | |-- action | + | |
- | | `-- action.php | + | |
- | |-- conf | + | |
- | | |-- default.php | + | |
- | | `-- metadata.php | + | |
- | |-- lang | + | |
- | | `-- en | + | |
- | | `-- settings.php | + | |
- | |-- plugin.info.txt | + | |
- | |-- README | + | |
- | |-- sxh3 | + | |
- | | |-- compass | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | |-- index.html | + | |
- | | |-- LGPL-LICENSE | + | |
- | | |-- MIT-LICENSE | + | |
- | | |-- scripts | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | |-- src | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | |-- styles | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | `-- tests | + | |
- | | |-- brushes | + | |
- | | | + | |
- | | |-- brushes_tests.html | + | |
- | | |-- cases | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | |-- commonjs_tests.js | + | |
- | | |-- js | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | |-- syntaxhighlighter_tests.html | + | |
- | | |-- theme_tests.html | + | |
- | | |-- webrick.rb | + | |
- | | `-- webrick.sh | + | |
- | `-- syntax | + | |
- | `-- syntax.php | + | |
- | </ | + |
plugin/syntaxhighlighter3.1452553042.txt.gz · Last modified: by 104.33.1.96