Skip to content

Syntax Highlighter

Olivier Carpentier edited this page Feb 27, 2017 · 8 revisions

Syntax Highlighter Web Part Overview

The Syntax Highlighter Web Part is a SharePoint client side web part built with the SharePoint Framework (SPFx). This web part adds an automatic code syntax viewer with a lot of supported languages as ActionScript3, Bash/shell, ColdFusion, C#, C++, CSS, Delphi, Diff, Erlang, Groovy, JavaScript, Java, JavaFX, Perl, PHP, Plain Text, PowerShell, Python, Ruby, Scala, SQL, Visual Basic, XML. You can also choose between themes to enhance your code. This Web Part uses the excellent and so popular SyntaxHighlighter by Alex Gorbatchev.

Thanks to this Web Part, you can copy/paste your code (as JavaScript) in a SharePoint page, and render it as a powerfull and elegant code editor.

Syntax Highlighter

Properties

You can manage the following settings:

  • code: your code
  • language: Choose a language to load the syntax. Can be: ActionScript3, Bash/shell, ColdFusion, C#, C++, CSS, Delphi, Diff, Erlang, Groovy, JavaScript, Java, JavaFX, Perl, PHP, Plain Text, PowerShell, Python, Ruby, Scala, SQL, Visual Basic, XML. Default is JavaScript.
  • theme: Choose a theme. Can be Default, Django, Eclipse, Emacs, Fade to Grey, MD Ultra, Midnight, RDark.
  • toolbar: Enables the toolbar '?' tip. Default is true
  • gutter: Show the left margin with line numbers. Default is true
  • autoLinks: Transform the founded url as clickable link. Default is true
  • smartTabs: Activate the smart tabs mode. Default is true

Screenshots

3DCarousel

Installing the web part

Click here to access to the Installation Process. You can install and test this web part without compiling the code by following this procedure.

Source Code

https://github.com/OlivierCC/spfx-40-fantastics/tree/master/src/webparts/syntaxHighlighter

Minimal Path to Awesome

  • Clone this repository
  • in the command line run:
    • npm install
    • gulp serve

Version history

Version Date Comments
1.0 October 2016 Initial release

Solution

Solution Author(s)
spfx-40-fantastics Olivier Carpentier (@olivierc)

The MIT License (MIT)

Copyright (c) 2016 Olivier Carpentier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You can’t perform that action at this time.