mcmotdparser

A parser for Minecraft Motds in the old style (plain text) and in the new style (json).


Keywords
minecraft, motd, parser, formatting, codes, color
License
GPL-3.0
Install
npm install mcmotdparser@1.3.1

Documentation

MCMotdParser Build Status

A parser for Minecraft motds which parses them to HTML

Supports parsing old and new format motds to HTML and parsing old format motds to new JSON format motds.

Usage NodeJS:
Install from npm (see https://www.npmjs.com/package/mcmotdparser):
npm install motdparser

const motdparser = require('mcmotdparser');
var motd = "§aSuper cool Server §7Come join us! §e§lNEW GAME:§b§l THE BRIDGE";
var html = "";
motdparser.toHtml(motd, (err, res) => {
	html = res;
});

Usage Web:

// Include this tag in your head or below your body
<script src="https://cdn.jsdelivr.net/gh/nailujx86/mcmotdparser@master/dist/motdparserweb.js" type="text/javascript"></script>

<script>
	var motd = "§aSuper cool Server §7Come join us! §e§lNEW GAME:§b§l THE BRIDGE";
	var html = "";
	motdParser.toHtml(motd, function(err, res) {
		html = res; // Do with this whatever you want :)
	});
</script>

To convert a "text" style motd to a modern json motd one can use motdParser.textToJson("motdtext", callback);

The CSS File which helps styling the output are in the dist/ Folder and on https://cdn.jsdelivr.net/gh/nailujx86/mcmotdparser@master/dist/mcmotd.css. Parsing is supported for motds in text format as well as motds in the Minecraft Json-Text Format.

Renders:

Render of the example above:
Motd0
Another example:
Motd1
And one last example:
Motd2

Size (gipped):

File Size
motdparserweb.js.gz 1424 bytes
mcmotd.css.gz 491 bytes
=> 1.9 kB all together