GitXplorerGitXplorer
A

highlightjs-lang

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
a323c6899ef719204877af001eb2dc541f7e9a55

update readme in preparation for archive

AAdamRaichu committed 2 years ago
Verified
862fef675b8b68544a71ae6948c8daf56dbd624e

add github pages for build distribution

AAdamRaichu committed 2 years ago
Verified
6e219f32bfbe31e6784e7c391ec63acd6fdaadc3

update grammar

AAdamRaichu committed 2 years ago
Verified
d3b723e2eb58596ddcfa6803144d354d5ec7ccce

highlight value as string

AAdamRaichu committed 2 years ago
Unverified
00db756041a446ae6c3cde5af9c5d7ec7833bccd

Merge branch 'main' of https://github.com/AdamRaichu/highlightjs-lang into main

AAdamRaichu committed 2 years ago
Unverified
a333630d051bdd02ff3949ce514e573d4c65be08

create test script

AAdamRaichu committed 2 years ago

README

The README file for this repository.

Highlight.js Lang

This repository has been moved to highlightjs/highlightjs-lang

This repository contains a language grammar for Minecraft's .lang files for highlight.js.

Basic Usage

Web Browser

First, include the main library as a script. Then, link this grammar. Be sure to also include a theme.

<link rel="stylesheet" href="/path/to/styles/default.min.css">
<script src="/path/to/highlight.min.js"></script>
<script src="/path/to/lang.min.js">
<script>hljs.highlightAll();</script>

This will find and highlight code inside of <pre><code> 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:

<pre><code class="language-lang">...</code></pre>

Node.js on the Server

Note: The following method will not work until this repo is added to the highlightjs organization.

The bare minimum to auto-detect the language and highlight some code.

// 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:

html = hljs.highlight('gameTip.findTree=Punch a tree to gather wood.\n...', {language: 'lang'}).value

See 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.