https://github.com/commandserver/javascript-syntax-highlighter-for-minecraft-functions
A Javascript function to highlight Minecraft functions code
https://github.com/commandserver/javascript-syntax-highlighter-for-minecraft-functions
highlighter mcfunction minecraft syntax-highlighting
Last synced: 2 months ago
JSON representation
A Javascript function to highlight Minecraft functions code
- Host: GitHub
- URL: https://github.com/commandserver/javascript-syntax-highlighter-for-minecraft-functions
- Owner: Commandserver
- License: gpl-3.0
- Created: 2020-07-11T22:39:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-12T21:01:01.000Z (about 2 years ago)
- Last Synced: 2025-01-26T20:32:44.070Z (4 months ago)
- Topics: highlighter, mcfunction, minecraft, syntax-highlighting
- Language: JavaScript
- Homepage:
- Size: 65.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Javascript syntax highlighter for Minecraft functions
A Javascript function to highlight Minecraft functions code.This Javascript highlighter can be used to highlight Minecraft code on your websides.
* tested on Minecraft version 1.13 to 1.16## Preview:

## How to use it
Just execute the `mclangHighlight` function and pass the minecraft command into it.
#### Example:
```javascript
document.getElementById('myElement').innerHTML = mclangHighlight("particle minecraft:barrier ~ ~42 ~ 0.4 0.5 0.4 1 6 force @a[gamemode=spectator]");
```## Installation
to use it on your webpage you have to declare the css variables to color the code.
You can use this css code:```css
span.selector {
color: #05cc94;
}
span.selectorProperties {
color: #4196b7;
}
span.not {
color: #ff5151;
}
span.minecraft {
color: #3c47e6;
}
span.number {
color: #db480f;
font-weight: bold;
}
span.bracket {
color: #05cc94;
font-weight: bold;
}
span.error {
background-color: #d0320d;
border-radius: 2px;
}
span.light-error {
background-color: #52503a;
border-radius: 2px;
text-decoration: underline;
text-decoration-style: dotted;
}
span.function {
color: #53a600;
}
span.comment {
color: #646363;
}
span.keyword {
color: #e951ff;
}
span.var {
color: #caa536;
}
```