Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

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/