jSyntax.js
2.5.0
See the version list below for details.
dotnet add package jSyntax.js --version 2.5.0
NuGet\Install-Package jSyntax.js -Version 2.5.0
<PackageReference Include="jSyntax.js" Version="2.5.0" />
paket add jSyntax.js --version 2.5.0
#r "nuget: jSyntax.js, 2.5.0"
// Install jSyntax.js as a Cake Addin #addin nuget:?package=jSyntax.js&version=2.5.0 // Install jSyntax.js as a Cake Tool #tool nuget:?package=jSyntax.js&version=2.5.0
Syntax.js v2.5.0
A lightweight, and easy-to-use, JavaScript library for code syntax highlighting!
What features does Syntax.js have?
- Zero-dependencies and extremely lightweight!
- Highlights keywords, values, strings, and comments.
- Full API available via public functions.
- Fully styled in CSS/SASS (including the buttons) and compatible with the Bootstrap library.
- Full CSS theme support (using :root variables, with a default dark-mode theme).
- Coping and Printing support is available via action buttons.
- Custom triggers for actions (when elements are rendered, keywords are clicked, etc).
- 27 of the most popular languages built in by default (with public function support to add more).
- Language aliases.
- Custom action buttons (via a binding attribute), with opening/closing support.
- Unknown language support (renders the display, but does not highlight any syntax).
- Tabbing (allows multiple languages to be shown in one tabbed container, which is great for code examples).
Where can I find the documentation?
All the documentation can be found here:
What browsers are supported?
All modern browsers (such as Google Chrome, FireFox, and Opera) are fully supported.
What are the most recent changes?
To see a list of all the most recent changes, click here.
What languages are supported by default?
bash
Bashc-plus-plus
C++c-sharp
C#c
Ccss
CSSdart
Dartdelphi
Delphif-sharp
F#go
GOhtml
HTMLjava
Javajavascript
JavaScriptkotlin
Kotlinlua
Luamatlab
Matlabms-sql
Microsoft SQLperl
Perlphp
PHPpowershell
Powershellpython
Pythonr
Rruby
Rubyrust
Rustscala
Scalaswift
Swifttypescript
TypeScriptvisual-basic
Visual Basic
How do I install Syntax.js?
You can install the library with npm into your local modules directory using the following command:
npm install jsyntax.js
Or, you can download the latest zipped up version here.
How do I get started?
To get started using Syntax.js, do the following steps:
1. Prerequisites:
Make sure you include the "DOCTYPE html" tag at the top of your HTML, as follows:
<!DOCTYPE html>
2. Include Files:
<link rel="stylesheet" href="dist/syntax.js.css">
<script src="dist/syntax.js"></script>
<script src="dist/languages/syntax.javascript.js"></script>
<script src="dist/languages/syntax.html.js"></script>
3. DOM Element Binding:
<div data-syntax-language="javascript">
var something = true;
if ( something ) {
console.log( "Output is written." ); // Comment
/* Multi-line
comment */
}
</div>
<code data-syntax-language="javascript" data-syntax-options="{ 'showCopyButton': false }" data-syntax-buttons="[ { 'text': 'Button 1', 'onClick': yourJsFunction } ]">
<pre>
var something = true;
if ( something ) {
console.log( "Output is written." ); // Comment
/* Multi-line
comment */
}
</pre>
</code>
<code data-syntax-language="tabbed">
<div data-syntax-language="javascript" data-syntax-tab-contents="true">
<pre>
var something = true;
if ( something ) {
console.log( "Output is written." ); // Comment
/* Multi-line
comment */
}
</pre>
</div>
<div data-syntax-language="html" data-syntax-tab-contents="{ 'title': 'HTML Language' }">
<pre>
<div class="header">
<h1 id="header">Syntax.js - Basic</h1>
<p>This is a basic example of how to use Syntax.js to highlight code inside a DOM element.</p>
</div>
</pre>
</div>
</code>
To see a list of all the available binding languages you can use for "data-syntax-language", click here.
To see a list of all the available binding options you can use for "data-syntax-options", click here.
To see a list of all the available custom triggers you can use for "data-syntax-options", click here.
To see a list of all the available binding options you can use for "data-syntax-buttons", click here.
To see a list of all the available binding options you can use for "data-syntax-tab-contents", click here.
4. Finishing Up:
That's it! Nice and simple. Please refer to the code if you need more help (fully documented).
How do I go about customizing Syntax.js?
To customize, and get more out of Syntax.js, please read through the following documentation.
1. Public Functions:
To see a list of all the public functions available, click here.
2. Configuration:
Configuration options allow you to customize how Syntax.js will function. You can set them as follows:
<script>
$syntax.setConfiguration( {
safeMode: false
} );
</script>
To see a list of all the available configuration options you can use, click here.
To see a list of all the available configuration options custom triggers you can use, click here.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.1.0 | 120 | 9/6/2024 |
3.0.1 | 120 | 7/18/2024 |
3.0.0 | 83 | 7/15/2024 |
2.6.0 | 127 | 6/18/2024 |
2.5.0 | 179 | 3/29/2024 |
2.4.3 | 142 | 2/26/2024 |
2.4.2 | 146 | 2/6/2024 |
2.4.1 | 193 | 1/18/2024 |
2.4.0 | 171 | 1/15/2024 |
2.3.1 | 167 | 1/4/2024 |
2.3.0 | 160 | 12/30/2023 |
2.2.0 | 184 | 12/29/2023 |
2.1.1 | 183 | 12/26/2023 |
2.1.0 | 166 | 12/20/2023 |
2.0.1 | 159 | 12/19/2023 |
2.0.0 | 127 | 12/18/2023 |
1.9.0 | 156 | 12/15/2023 |
1.8.2 | 163 | 12/13/2023 |
1.8.1 | 139 | 12/13/2023 |
1.8.0 | 153 | 12/11/2023 |
1.7.3 | 141 | 12/10/2023 |
1.7.2 | 193 | 12/10/2023 |
1.7.1 | 174 | 12/10/2023 |
1.7.0 | 146 | 12/9/2023 |
1.6.2 | 128 | 12/8/2023 |
1.6.1 | 169 | 12/8/2023 |
1.6.0 | 137 | 12/7/2023 |
1.5.1 | 187 | 12/6/2023 |
1.5.0 | 164 | 12/6/2023 |
1.4.0 | 171 | 12/5/2023 |
1.3.0 | 170 | 12/5/2023 |
1.2.0 | 218 | 12/4/2023 |
1.1.0 | 182 | 12/2/2023 |
1.0.0 | 171 | 12/1/2023 |
0.8.0 | 157 | 11/30/2023 |
0.7.0 | 161 | 11/28/2023 |