Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/highlightjs/highlightjs-lang
A highlight.js grammar for Minecraft's language files
https://github.com/highlightjs/highlightjs-lang
highlight-js highlightjs-syntax syntax-highlighting
Last synced: 1 day ago
JSON representation
A highlight.js grammar for Minecraft's language files
- Host: GitHub
- URL: https://github.com/highlightjs/highlightjs-lang
- Owner: highlightjs
- License: mit
- Created: 2023-01-18T00:14:29.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-31T17:52:15.000Z (almost 2 years ago)
- Last Synced: 2024-11-07T13:24:07.753Z (about 2 months ago)
- Topics: highlight-js, highlightjs-syntax, syntax-highlighting
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 3
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Highlight.js Lang
This repository contains a language grammar for Minecraft's `.lang` files for [highlight.js][hljs-website].
## Basic Usage
### Web Browser
First, include the main library as a script. Then, link this grammar. Be sure to also include a [theme][hljs-themes].
```html
<script>hljs.highlightAll();
```This will find and highlight code inside of `
` tags; it tries
to detect the language automatically. If automatic detection doesn’t
work for you, or you simply prefer to be explicit, you can specify the language manually in the using the `class` attribute:```html
...
```### Node.js on the Server
The bare minimum to auto-detect the language and highlight some code.
```js
// load the library and ALL languages
hljs = require('highlight.js');
html = hljs.highlightAuto('gameTip.findTree=Punch a tree to gather wood.').value
```To highlight code with a specific language, use `highlight`:
```js
html = hljs.highlight('gameTip.findTree=Punch a tree to gather wood.\n...', {language: 'lang'}).value
```> **Note**: Because lang can be so generic at times, it is recommended to not rely on autodetection and instead use `highlight` and specify the language.
See [Importing the Library](https://github.com/highlightjs/highlight.js#importing-the-library) for more examples of `require` vs `import` usage, etc. For more information about the result object returned by `highlight` or `highlightAuto` refer to the [api docs](https://highlightjs.readthedocs.io/en/latest/api.html).
[hljs-website]: https://highlightjs.org/
[hljs-themes]: https://highlightjs.org/static/demo/