Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/coldspirit0/synhi
- Owner: ColdSpirit0
- License: mit
- Created: 2020-07-03T05:38:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-03T22:51:44.000Z (over 4 years ago)
- Last Synced: 2024-11-09T08:31:58.087Z (about 2 months ago)
- Topics: easy-to-use, javascript, simple, syntax, syntax-highlighter, syntax-highlighting
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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. EnjoyThat 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)