syntaxtint v0.1.7
syntaxtint
A high-performance library for syntax highlighting your code(rendered to HTML).
Features
- High-Performance
Most of my tests where completed in ~1-4 milliseconds!
- Highly Modular/Customizable
Easily create new language syntax and themes for your projects, or contribute them to the syntaxtint project!
Here's an example of what the final result(C++ and One Dark theme):
Installing
NodeJS
node i syntaxtint
Usage
Global Variables
If process.autoLoadThemes
is set to false, syntaxtint will not automatically load themes, so you can add any themes you want yourself, and the same is with process.autoLoadLanguages
, except for with languages.
Highlighting Code
You can syntax-highlight code by calling the following function:
<syntaxtint>.render(languageName: string, themeName: string, code: string)
Example:
syntaxtint.render('javascript', 'onelight',
`function myTestFunction() {
console.log("Hello, World!")
}`)
Current Supported Languages
These languages are implemented and usable in the syntaxtint.render
function. if you notice a bug, please report it as a github issue, thanks!
- C
Aliases: c
- C#
Aliases: c#
, csharp
- C++
Aliases: c++
, cpp
- JavaScript
Aliases: javascript
, js
- JSON
Aliases: json
Current Themes
These themes are implemented and usable in the syntaxtint.render
function. if you notice a bug, please report it as a github issue, thanks!
- OneDark
- OneLight
API Docs
function addLanguage(language: Language)
Adds the specified language to the list of usable languages.
function addTheme(theme: Theme)
Adds the specified to the list of usable themes.
function render(languageName: string, themeName: string, code: string)
Returns syntax-higlighted code as rendered html.
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago