DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:syntaxhighlightjs

SyntaxHighlightJS Plugin

Compatible with DokuWiki

2014-09-29 2015-08-10

plugin Syntax Highlighter for DokuWiki with highlight.js

Last updated on
2015-12-27
Provides
Syntax, Helper, Action
Repository
Source
Conflicts with
syntaxhighlighter3

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to syntaxhighlighter3

Tagged with code, highlight, highlightjs, source, sourcecode, syntax

This plugin gives you the ability to highlight the code(using Highlight.JS Plugin) inside containers (pre > code) with following options:

  • a programming language
  • a width
  • a certain class (with loads of useful preset classes, ex. center, round)

Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Syntax

Basic Syntax:

<sxh language width classes>
source code
</sxh>

Examples

A simple usage:

<sxh python>
  from sys import exit
  
  def main():
      sys.exit(0)
  
  if __name__ == '__main__':
    main()
</sxh>

Some more complex usage

<sxh js 70%>
var gulp = require('gulp');

gulp.task('default', function() {
  // place code for your default task here
});
</sxh>
<sxh cs 60% center>
Private newPropertyValue As String
Public Property NewProperty() As String
  Get
      Return newPropertyValue
  End Get
  Set(ByVal value As String)
      newPropertyValue = value
  End Set
End Property
</sxh>
<sxh cpp round>
#if 0
#include "pch.h"  // or whatever line you had selected
#endif // 0
</sxh>
  • Screenshot

Configuration and Settings

Option Description Default value
syntax Which name to use for syntax sxh
theme theme for styling your code default
restrictedClasses restrict usage of plugin to these (comma separated) classes (empty)

Development

Change Log

  • 2015-12-27
    • Initial release

Known Bugs and Issues

ToDo/Wish List

  • Support line-number
  • Support in the editing toolbar

FAQ

  • Not yet

Credits

Discussion

Before reporting any issues (bugs or requests), please first take a look at the FAQ on plugin problems.

You can report any issues either on the Issue Tracker or on the separate discussion page.

plugin/syntaxhighlightjs.txt · Last modified: 2018-05-29 23:45 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki