Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/coldspirit0/synhi

Simple syntax highlighter
https://github.com/coldspirit0/synhi

easy-to-use javascript simple syntax syntax-highlighter syntax-highlighting

Last synced: 4 days ago
JSON representation

Simple syntax highlighter

Awesome Lists containing this project

README

        

# Synhi - simple syntax highlighter

Synhi is a tool in one function to create own syntax themes.

## How to use:

### 1. Insert code in your project
That's all code you need: [synhi.js](synhi.js).

### 2. Add CSS classes you need

Example:

```css
.hl_keyword {color: blue;}
```

### 3. Highlight your text

Call the function and pass element with text, regex rule to find it and class that will highlight the text.

```javascript
highlight(target_element, /(keyword)/, "hl_keyword");
```
### 4. Enjoy

That result you will get:

![Example image](example.png)

### Demo with ini syntax
This example does not cover the entire ini syntax; it is made to show the capabilities of the tool.

https://jsfiddle.net/ColdSpirit/6v74p8x5/

Demo backup: [demo_ini.html](demo_ini.html)