Syntax.js
A lightweight, and easy-to-use, JavaScript library for code syntax highligh...
README
Syntax.js
What features does Syntax.js have?
- Zero-dependencies and extremely lightweight!
- 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).
- Custom triggers for actions (when elements are rendered, keywords are clicked, etc).
- 12 of the most popular languages built in by default (you can add your own easily if yours is not supported by default).
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.
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 email, as follows:
- ```markdown
- DOCTYPE html>
- ```
2. Include Files:
- ```markdown
- <link rel="stylesheet" href="dist/syntax.js.css" />
- <script src="dist/syntax.js"></script>
- <script src="dist/languages/syntax.javascript.js"></script>
- ```
3. Create DOM Container:
- ```markdown
- <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 }">
- <pre>
- var something = true;
- if ( something ) {
- console.log( "Output is written." ); // Comment
- /* Multi-line
- comment */
- }
- </pre>
- </code>
- ```
To see a list of all the available options you can use for "data-syntax-options".
To see a list of all the available custom triggers you can use for "data-syntax-options".
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.