Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/cutwell/2001-syntax-highlighter

GNU Nano-style syntax highlighting on the web.
https://github.com/cutwell/2001-syntax-highlighter

gnu-nano javascript syntax-highlighting

Last synced: 11 days ago
JSON representation

GNU Nano-style syntax highlighting on the web.

Awesome Lists containing this project

README

        

# 2001-syntax-highlighter
GNU Nano-style syntax highlighting on the web.

### Including in your project
The highlighter is written in pure JavaScript, so no additional libraries are required. Just include the highlight and language files inside your .html project.
```html

```
```
path/to/ | -> 2001.js
| -> Language.js
| -> Language.css
```

### Usage
Insert code you want to highlight between `````` tags, then add the correct language to let the script provide correct colouring.
```html

Lorem Ipsum...

```

### Features
| Function | |
| :---: | :---: |
| ```highlight()``` | Adds correct syntax highlighting to all `````` blocks inside the file. |

### Obtaining text from inside a formatted \ block
```javascript
var text = document.getElementById(id).innerText;
```

### Custom syntax highlighting
2001 supports different themes within a language.
1. *.JS contains the regex and intended color code.
2. *.CSS matches those color codes into the correct text color.
By customising the .CSS file, or creating new files, you can use a different theme for a language.

### Contributing
Additional syntax themes for new languages, or new themes for currently supported languages, are always welcome. Ensure you make clear what language your are supporting and the name of your theme inside the pull request in order to get it accepted swiftly.