This package implements syntax highlighting in modules.
Formats <pre> .. </pre> sections automatically using highlight.js.
This module can be referenced by sites, pages or modules, in which case <pre> .. </pre> sections are formatted using highlight.js.
The appearance of the <pre> .. </pre> sections using syntax highlighting can be defined using Syntax Highlighter Settings accessible using Admin > Settings > Syntax Highlighter Settings (standard YetaWF site), Highlight.js tab.
Syntax highlighting can be configured on each <pre> or <code> Html tag. Additional information about configuring syntax highlighting can found at https://highlightjs.org/.
The following languages are currently available (language names are available at http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html#language-names-and-aliases):
Language | Language Names (Css Class) |
---|---|
Apache | apache, apacheconf |
Bash | bash, sh, zsh |
C# | cs, csharp |
C++ | cpp, c, cc, h, c++, h++, hpp |
CSS | css |
CoffeeScript | coffeescript, coffee, cson, iced |
Diff | diff, patch |
HTML, XML | xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist |
HTTP | http, https |
Ini | ini |
JSON | json |
Java | java, jsp |
JavaScript | javascript, js, jsx |
Makefile | makefile, mk, mak |
Markdown | markdown, md, mkdown, mkd |
Nginx | nginx, nginxconf |
Objective-C | objectivec, mm, objc, obj-c |
PHP | php, php3, php4, php5, php6 |
Perl | perl, pl, pm |
Python | python, py, gyp |
Ruby | ruby, rb, gemspec, podspec, thor, irb |
SQL | sql |
Shell Session | shell, console |
Highlight.js uses the defined Css class to determine the language (using one of the language names, optionally prefixed by language- or lang-). The language name can be omitted, in which case highlight.js will detect the language automatically. The Css class "lang-nohighlight" can be used to turn off highlighting so highlight.js doesn't automatically determine the language.
Example
<pre class="language-js"> function somejavascript() { var x = 20; x += 10; return x; } </pre>
function somejavascript() { var x = 20; x += 10; return x; }
It is possible to add and remove languages by downloading a custom version of highlight.js at https://highlightjs.org/download/. Select/deselect all desired languages and download. Extract highlight.pack.js from the downloaded Zip file and place it into the folder shown below (which may need to be created).
Replace domain.com with the name of the domain. Each site within one YetaWF instance can have its own set of languages and is not shared.
./Website/wwwroot/AddonsCustom/domain.com/YetaWF/SyntaxHighlighter/_Addons/SkinHighlightJS
Module Name | Description |
---|---|
Syntax Highlighter Settings Module | Configuration module for syntax highlighting. Define the appearance of sections using syntax highlighting. It is accessible using Admin > Settings > Syntax Highlighter Settings (standard YetaWF site). |
Module Name | Description |
---|---|
Syntax Highlighter Highlight.js (Skin) Module | Skin module supporting syntax highlighting in modules using Highlight.js, referenced by sites, pages or modules, in which case <pre> .. </pre> sections are rendered using syntax highlighting. |
The YetaWF.SyntaxHighlighter package is part of YetaWF, an open source product licensed under the GNU General Public License, version 3 (GPL-3.0) - Copyright - Softel vdm, Inc.
Last Updated 04/24/2022 - (email)
© 2023 - Softel vdm, Inc. - YetaWF.com