Micron Parser JavaScript implementation https://sudo-ivan.github.io/micron-parser-js/
Find a file
2025-11-23 00:44:52 -06:00
.github/workflows add JS minification GitHub action 2025-03-16 00:37:07 -04:00
css Make PWA fully offline by replacing Tailwind CDN with local installation 2025-09-26 03:34:33 -05:00
fonts Project init 2024-12-27 17:19:45 -05:00
js Automated minification of micron-parser.js 2025-08-13 17:30:22 +00:00
src Make PWA fully offline by replacing Tailwind CDN with local installation 2025-09-26 03:34:33 -05:00
vendor fix for tag only lines creating a newline <br> 2025-02-12 21:39:08 -05:00
.gitignore Make PWA fully offline by replacing Tailwind CDN with local installation 2025-09-26 03:34:33 -05:00
index.html add russian 2025-11-23 00:44:52 -06:00
LICENSE Create LICENSE 2025-03-16 00:19:58 -04:00
manifest.json Add SVG icon to manifest for PWA installation 2025-09-26 03:31:08 -05:00
package-lock.json Make PWA fully offline by replacing Tailwind CDN with local installation 2025-09-26 03:34:33 -05:00
package.json Make PWA fully offline by replacing Tailwind CDN with local installation 2025-09-26 03:34:33 -05:00
README.md Update README.md 2025-03-13 20:55:01 -04:00
README_RU.md add russian 2025-11-23 00:44:52 -06:00
sw.js Make PWA fully offline by replacing Tailwind CDN with local installation 2025-09-26 03:34:33 -05:00
tailwind.config.js Make PWA fully offline by replacing Tailwind CDN with local installation 2025-09-26 03:34:33 -05:00

Micron Parser JS

This repository provides a JavaScript parser for Micron, a lightweight, terminal-friendly markdown format used in NomadNet and MeshChat

Requirements

Micron Parser JS requires DOMpurify for HTML/XSS sanitization. To install DOMpurify, include it with your script tags above micron-parser.js or install via a package manager like NPM npm install micron-parser

Usage

// Import Micron Parser (requires modules)
import MicronParser from './js/micron-parser.js';

// Create a new parser (darkTheme = true/false | defaults to true, forceMonospace = true/false | defaults to true)
const parser = new MicronParser(true, true);

// Input Micron markup
const micronMarkup = `
> Example Heading
-∿
This is a simple line in Micron.
# This line is a comment and won't appear in the output.
`;

// Convert Micron to an HTML string
const htmlOutput = parser.convertMicronToHtml(micronMarkup);

// Insert it into your page
document.getElementById('yourElement').innerHTML = htmlOutput;

// Or create a DocumentFragment from Micron
const domFragment = parser.convertMicronToFragment(micronMarkup);
// and append it to the DOM
document.body.appendChild(domFragment);

Best practices

For optimal display of Micron content in the browser it's recommended to use a monospaced font with NerdFont icon support, such as the ones provided here.