All Projects → crazy-max → dokuwiki-plugin-syntaxhighlighter4

crazy-max / dokuwiki-plugin-syntaxhighlighter4

Licence: other
SyntaxHighlighter4 plugin for DokuWiki

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to dokuwiki-plugin-syntaxhighlighter4

MagicWE2
[MagicWE2] Lag free asynchronous world editor for PMMP with plenty of options
Stars: ✭ 109 (+113.73%)
Mutual labels:  clipboard, brushes
cbs
interface to manage clipboard from the command line
Stars: ✭ 25 (-50.98%)
Mutual labels:  clipboard
clipsync-windows
Clipboard which sync with Android and Windows Platform.
Stars: ✭ 20 (-60.78%)
Mutual labels:  clipboard
copypasta
Cross-platform Rust system clipboard library
Stars: ✭ 186 (+264.71%)
Mutual labels:  clipboard
ImageClipboard.jl
Copy & Paste images with Julia
Stars: ✭ 33 (-35.29%)
Mutual labels:  clipboard
clipper
📋 Cross Platform Desktop App to Save history of all information you copy and use them whenever with a solitary snap
Stars: ✭ 42 (-17.65%)
Mutual labels:  clipboard
no-clipboard-app
Share your clipboard text to your device like Oculus Go.
Stars: ✭ 12 (-76.47%)
Mutual labels:  clipboard
nativescript-clipboard
📋 NativeScript plugin to copy stuff to the device clipboard, and read from it again
Stars: ✭ 40 (-21.57%)
Mutual labels:  clipboard
fauxClip
Clipboard support for Vim without +clipboard
Stars: ✭ 32 (-37.25%)
Mutual labels:  clipboard
AsyncClipboardService
📋 An async & low-level windows clipboard service implementation for .NET, C#
Stars: ✭ 14 (-72.55%)
Mutual labels:  clipboard
Json-to-Dart-Model
marketplace.visualstudio.com/items?itemName=hirantha.json-to-dart
Stars: ✭ 84 (+64.71%)
Mutual labels:  clipboard
uniclip
Cross-platform shared clipboard
Stars: ✭ 116 (+127.45%)
Mutual labels:  clipboard
unlimited-clipboard
simple clipboard manager with unlimited history on electron
Stars: ✭ 21 (-58.82%)
Mutual labels:  clipboard
WinPopclip
Popclip alternative for Windows
Stars: ✭ 76 (+49.02%)
Mutual labels:  clipboard
json-to-go
将json生成go的数据结构。Online tool that convert JSON to Go.
Stars: ✭ 16 (-68.63%)
Mutual labels:  clipboard
Copy-button
copy textview into anywhere
Stars: ✭ 14 (-72.55%)
Mutual labels:  clipboard
nougat
Screenshot wrapper
Stars: ✭ 20 (-60.78%)
Mutual labels:  clipboard
nspages
Plugin for dokuwiki - Display tables of content
Stars: ✭ 21 (-58.82%)
Mutual labels:  dokuwiki
dokuwiki-plugin-bootswrapper
Bootstrap Wrapper for DokuWiki
Stars: ✭ 33 (-35.29%)
Mutual labels:  dokuwiki
org-rich-yank
📋 Rich text clipboard for org-mode: Paste as a #+BEGIN_SRC block of correct mode, with link to where it came from
Stars: ✭ 59 (+15.69%)
Mutual labels:  clipboard

Github Release Minimum DokuWiki Version
Become a sponsor Donate Paypal

About

This plugin is an alternative to GeSHi server-side code highlighting of DokuWiki with client-side SyntaxHighlighter by Alex Gorbatchev.

The subfolder syntaxhighlighter4/dist contains a build of SyntaxHighlighter 4.x.

For compatibility and conflicts with others plugins, please refer to the official DokuWiki SyntaxHighlighter4 plugin page.

Download and Installation

Download and install the plugin using the Plugin Manager using the download link given above. Refer to Plugins on how to install plugins manually.

If you install this plugin manually, make sure it is installed in lib/plugins/syntaxhighlighter4/. If the folder is called different it will not work!

Syntax and Usage

<sxh [brush][; options]>
... code/text ...
</sxh>

Brush

The brush (language) that SyntaxHighlighter should use. Defaults to "text" if none is provided.
See the section brushes and themes for a complete list of available brushes.

Options

Semicolon separated options for SyntaxHighlighter, see SyntaxHighlighter Configuration.
The plugin handles the Block Title from SyntaxHighlighter 3 as an option, i.e. title: <title string>;.

Defaults

Syntaxhighlighter default options can be overrided via the Config Manager :

  • autoLinks: Allows you to turn detection of links in the highlighted element on and off. If the option is turned off, URLs won’t be clickable (default true)
  • firstLine: Allows you to change the first (starting) line number (default 1)
  • gutter: Allows you to turn gutter with line numbers (default true)
  • htmlScript: Allows you to highlight a mixture of HTML/XML code and a script which is very common in web development. Setting this value to true requires that you have shBrushXml.js loaded and that the brush you are using supports this feature (default false)
  • smartTabs: Allows you to turn smart tabs feature on and off (default true)
  • tabSize: Allows you to adjust tab size (default 4)
  • override: List of tags to override

Example

<sxh php; first-line: 89; highlight: [106,107]; title: New title attribute in action>
    /**
     * Render xhtml output or metadata
     *
     * @param string         $mode      Renderer mode (supported modes: xhtml)
     * @param Doku_Renderer  $renderer  The renderer
     * @param array          $data      The data from the handler() function
     * @return bool If rendering was successful.
     */
    public function render($mode, Doku_Renderer &$renderer, $data) {
        if($mode != 'xhtml') return false;

        if (count($data) != 3) {
            return true;
        }

        list($syntax, $attr, $content) = $data;
        if ($syntax == 'sxh') {
            $title = $this->procTitle($attr);
            $highlight = $this->procHighlight($attr);
            $renderer->doc .= '<pre class="brush: ' . strtolower($attr . $highlight) . '"' . $title . '>' . $renderer->_xmlEntities($content) . '</pre>';
        } else {
            $renderer->file($content);
        }

        return true;
    }
</sxh>

Expected result:

Features

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.

Highlight a range of lines

Example:

<sxh php; highlight: [11-15]>
    /**
     * [Custom event handler which performs action]
     *
     * @param Doku_Event $event  event object by reference
     * @param mixed      $param  [the parameters passed as fifth argument to register_hook() when this
     *                           handler was registered]
     * @return void
     */

    public function handle_metaheader(Doku_Event &$event, $param) {
        // Add SyntaxHighlighter theme.
        $event->data['link'][] = array('rel' => 'stylesheet',
            'type' => 'text/css',
            'href' => DOKU_BASE . 'lib/plugins/syntaxhighlighter4/dist/'.$this->getConf('theme'),
        );

        // Register SyntaxHighlighter javascript.
        $event->data["script"][] = array("type" => "text/javascript",
            "src" => DOKU_BASE . "lib/plugins/syntaxhighlighter4/dist/syntaxhighlighter.js",
            "_data" => ""
        );
    }
</sxh>

Expected result:

List of brushes and themes

  • Official brushes
    • applescript
    • as3
    • base
    • bash
    • coldfusion
    • cpp
    • csharp
    • css
    • delphi
    • diff
    • erlang
    • groovy
    • haxe
    • java
    • javafx
    • javascript
    • perl
    • php
    • plain
    • powershell
    • python
    • ruby
    • sass
    • scala
    • sql
    • swift
    • tap
    • typescript
    • vb
    • xml
  • Custom brushes
    • halcon
    • IEC61131
    • kotlin
    • latex
    • Makefile
    • mel
    • objective-c
    • yaml
  • Official themes
    • default
    • django
    • eclipse
    • emacs
    • fadetogrey
    • mdultra
    • midnight
    • rdark
    • swift
  • Custom themes

How can I help ?

All kinds of contributions are welcome 🙌! The most basic way to show your support is to star 🌟 the project, or to raise issues 💬 You can also support this project by becoming a sponsor on GitHub 👏 or by making a Paypal donation to ensure this journey continues indefinitely! 🚀

Thanks again for your support, it is much appreciated! 🙏

License

GPLv2. See LICENSE for more details.
Icon credit to Snip Master.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].