https://github.com/artemklevtsov/mediawiki-syntaxhighlight
This MediaWiki extension adds syntaxhighlight tag that is implemented using highlight.js library.
https://github.com/artemklevtsov/mediawiki-syntaxhighlight
Last synced: 3 months ago
JSON representation
This MediaWiki extension adds syntaxhighlight tag that is implemented using highlight.js library.
- Host: GitHub
- URL: https://github.com/artemklevtsov/mediawiki-syntaxhighlight
- Owner: artemklevtsov
- License: gpl-2.0
- Created: 2014-02-20T14:10:03.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-27T19:25:56.000Z (over 10 years ago)
- Last Synced: 2023-04-05T13:45:18.451Z (about 2 years ago)
- Language: PHP
- Homepage:
- Size: 770 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.mediawiki
- License: LICENSE
Awesome Lists containing this project
README
= MediaWiki-SyntaxHighlight =
This MediaWiki extension adds '''syntaxhighlight''' tag that is implemented using
[http://highlightjs.org highlight.js] library.== Requirements ==
* MediaWiki 1.17 or above.
== Installation ==
=== Step 1: Downloading ===
You can download the snapshot [https://github.com/unikum/MediaWiki-SyntaxHighlight/archive/master.zip zip file] and extract the files to your
extensions
directory. For example using wget and unzip tools:
cd /tmp
wget https://github.com/unikum/MediaWiki-SyntaxHighlight/archive/master.zip
unzip master.zip -d $WIKIROOT/extensions/SyntaxHighlightThis extention already include latest version of the highlight.js library which include all supported languages. You can also download highlight.js library with soppurt only a needed languages from [http://highlightjs.org/download/ this page]. Check a needed languages and press "Download" button. Then extract
highlight.zip
toSyntaxHighlight/highlight.js
directory.=== Step 2: Installation ===
Add this line to the end of your [http://www.mediawiki.org/wiki/Manual:LocalSettings.php LocalSettings.php]:
require_once "$IP/extensions/SyntaxHighlight/SyntaxHighlight.php";Installation can now be verified through
Special:Version
page on your wiki.== Configuration ==
You can specify highlight style by
$wgSyntaxHighlightStyle
in your [http://www.mediawiki.org/wiki/Manual:LocalSettings.php LocalSettings.php]:
$wgSyntaxHighlightStyle = 'xcode';
require_once "$IP/extensions/SyntaxHighlight/SyntaxHighlight.php";You should put this line '''before'''
require_once
line.By default highlight.js buileded for support only a common languages: Apache, Bash, C++, C#, CoffeeScript, CSS, Diff, HTTP, Ini file, Java, JavaScript, JSON, Markdown, Makefile, Nginx, ObjectiveC, Perl, PHP, Python, Ruby, SQL, XML.
If you want use an additional languages you should specify it with
$wgSyntaxHighlightAdditionalLanguages
option.
$wgSyntaxHighlightAdditionalLanguages = array('lua', 'r', 'tex');
require_once "$IP/extensions/SyntaxHighlight/SyntaxHighlight.php";You should put this line '''before'''
require_once
line.== Usage ==
On the wiki page, you can now use "syntaxhighlight" elements:
html text
echo $v; // end of php code
?>You can specify language by
lang=""
parameter. Iflang
parameter isn't defined language will be detected automaticy.== Supported languages ==
These are the languages that can be used in the '''lang''' parameter.
{| class="wikitable"
! Code
! Language
|-
|1c
|| 1C
|-
|actionscript
|| ActionScript
|-
|apache
|| Apache
|-
|applescript
|| AppleScript
|-
|asciidoc
|| AsciiDoc
|-
|autohotkey
|| AutoHotkey
|-
|avrasm
|| AVR Assembler
|-
|axapta
|| Axapta
|-
|bash
|| Bash
|-
|brainfuck
|| Brainfuck
|-
|clojure
|| Clojure
|-
|cmake
|| CMake
|-
|coffeescript
|| CoffeeScript
|-
|cpp
|| C++
|-
|cs
|| C#
|-
|css
|| CSS
|-
|delphi
|| Delphi
|-
|diff
|| Diff
|-
|django
|| Django
|-
|d
|| D
|-
|dos
|| DOS .bat
|-
|elixir
|| Elixir
|-
|erlang
|| Erlang
|-
|erlang-repl
|| Erlang REPL
|-
|fix
|| FIX
|-
|fsharp
|| F#
|-
|glsl
|| GLSL
|-
|go
|| Go
|-
|haml
|| Haml
|-
|handlebars
|| Handlebars
|-
|haskell
|| Haskell
|-
|http
|| HTTP
|-
|ini
|| Ini
|-
|java
|| Java
|-
|javascript
|| JavaScript
|-
|json
|| JSON
|-
|lasso
|| Lasso
|-
|lisp
|| Lisp
|-
|livecodeserver
|| LiveCode server and revIgniter
|-
|lua
|| Lua
|-
|makefile
|| Makefile
|-
|markdown
|| Markdown
|-
|mathematica
|| Mathematica
|-
|matlab
|| Matlab
|-
|mel
|| MEL
|-
|mizar
|| Mizar
|-
|nginx
|| Nginx
|-
|nix
|| Nix
|-
|nsis
|| NSIS
|-
|objectivec
|| Objective C
|-
|ocaml
|| OCaml
|-
|oxygene
|| Oxygene
|-
|parser3
|| Parser3
|-
|perl
|| Perl
|-
|php
|| PHP
|-
|profile
|| Python profile
|-
|protobuf
|| Protocol Buffers
|-
|python
|| Python
|-
|rib
|| RenderMan RIB
|-
|r
|| R
|-
|rsl
|| RenderMan RSL
|-
|ruby
|| Ruby
|-
|ruleslanguage
|| Oracle Rules Language
|-
|rust
|| Rust
|-
|scala
|| Scala
|-
|scilab
|| Scilab
|-
|scss
|| SCSS
|-
|smalltalk
|| Smalltalk
|-
|sql
|| SQL
|-
|tex
|| TeX
|-
|vala
|| Vala
|-
|vbnet
|| VB.NET
|-
|vbscript
|| VBScript
|-
|vhdl
|| VHDL
|-
|vim
|| Vim Script
|-
|x86asm
|| Intel x86 Assembly
|-
|xml
|| HTML, XML
|}== Theme Styles ==
These are the styles that can be used in the '''$wgSyntaxHighlightStyle''' extention parameter.
You can show this styles on [http://highlightjs.org/static/test.html live demo page].
{| class="wikitable"
! Code
! Style Name
|-
|default
|| Default
|-
|dark
|| Dark
|-
|far
|| FAR
|-
|idea
|| IDEA
|-
|sunburst
|| Sunburst
|-
|zenburn
|| Zenburn
|-
|vs
|| Visual Studio
|-
|ascetic
|| Ascetic
|-
|magula
|| Magula
|-
|github
|| GitHub
|-
|googlecode
|| Google Code
|-
|brown_paper
|| Brown Paper
|-
|school_book
|| School Book
|-
|ir_black
|| IR Black
|-
|solarized_dark
|| Solarized - Dark
|-
|solarized_light
|| Solarized - Light
|-
|arta
|| Arta
|-
|monokai
|| Monokai
|-
|monokai_sublime
|| Monokai Sublime
|-
|xcode
|| XCode
|-
|pojoaque
|| Pojoaque
|-
|rainbow
|| Rainbow
|-
|tomorrow
|| Tomorrow
|-
|tomorrow-night
|| Tomorrow Night
|-
|tomorrow-night-bright
|| Tomorrow Night Bright
|-
|tomorrow-night-blue
|| Tomorrow Night Blue
|-
|tomorrow-night-eighties
|| Tomorrow Night Eighties
|-
|railscasts
|| Railscasts
|-
|obsidian
|| Obsidian
|-
|docco
|| Docco
|-
|mono-blue
|| Mono Blue
|-
|foundation
|| Foundation
|-
|atelier-dune.dark
|| Atelier Dun - Dark
|-
|atelier-dune.light
|| Atelier Dun - Light
|-
|atelier-forest.dark
|| Atelier Forest - Dark
|-
|atelier-forest.light
|| Atelier Forest - Light
|-
|atelier-heath.dark
|| Atelier Heath - Dark
|-
|atelier-heath.light
|| Atelier Heath - Light
|-
|atelier-lakeside.dark
|| Atelier Lakeside - Dark
|-
|atelier-lakeside.light
|| Atelier Lakeside - Light
|-
|atelier-seaside.dark
|| Atelier Seaside - Dark
|-
|atelier-seaside.light
|| Atelier Seaside - Light
|-
|paraiso.dark
|| Paraiso - Dark
|-
|paraiso.light
|| Paraiso - Light
|}== License ==
This Extention licensed under GPL v2 License.
== Installation from Git ==
=== Getting extension ===
You can use a Git clone tool to clone https://github.com/unikum/MediaWiki-SyntaxHighlight in the extensions directory of your wiki. For example using the Git command-line tool from
wiki/extensions
directory:
git clone https://github.com/unikum/MediaWiki-SyntaxHighlight SyntaxHighlightMake sure the below control executes from within wiki/extensions/ folder. Otherwise you need to move this folder from current location to wiki/extensions folder using
mv