You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This NPM package 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. You can install it via npm install dompurify
Usage
// Import Micron Parser (requires modules)importMicronParserfrom'micron-parser';// Create a new parser (darkTheme = true/false | defaults to true, forceMonospace = true/false | defaults to true)constparser=newMicronParser(true,true);// Input Micron markupconstmicronMarkup=`> 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 stringconsthtmlOutput=parser.convertMicronToHtml(micronMarkup);// Insert it into your pagedocument.getElementById('yourElement').innerHTML=htmlOutput;// Or create a DocumentFragment from MicronconstdomFragment=parser.convertMicronToFragment(micronMarkup);// and append it to the DOMdocument.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.