{"id":28477307,"url":"https://github.com/wasabithumb/minimessage-js","last_synced_at":"2026-01-26T03:17:23.427Z","repository":{"id":251093369,"uuid":"836439567","full_name":"WasabiThumb/minimessage-js","owner":"WasabiThumb","description":"Lenient MiniMessage parser and HTML serializer made in TypeScript","archived":false,"fork":false,"pushed_at":"2025-05-22T18:45:24.000Z","size":18538,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T16:14:36.694Z","etag":null,"topics":["html","javascript","minecraft","minimessage","rich-text","text-component","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WasabiThumb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-31T21:16:57.000Z","updated_at":"2025-05-30T20:56:54.000Z","dependencies_parsed_at":"2024-08-05T16:43:18.816Z","dependency_job_id":null,"html_url":"https://github.com/WasabiThumb/minimessage-js","commit_stats":null,"previous_names":["wasabithumb/minimessage-js"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WasabiThumb/minimessage-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WasabiThumb%2Fminimessage-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WasabiThumb%2Fminimessage-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WasabiThumb%2Fminimessage-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WasabiThumb%2Fminimessage-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WasabiThumb","download_url":"https://codeload.github.com/WasabiThumb/minimessage-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WasabiThumb%2Fminimessage-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263184586,"owners_count":23427048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html","javascript","minecraft","minimessage","rich-text","text-component","typescript"],"created_at":"2025-06-07T16:12:12.253Z","updated_at":"2026-01-26T03:17:23.420Z","avatar_url":"https://github.com/WasabiThumb.png","language":"TypeScript","readme":"# minimessage-js\n\n[Source Code](https://github.com/WasabiThumb/minimessage-js/) | [NPM Page](https://www.npmjs.com/package/minimessage-js) | [Web Demo](https://wasabithumb.github.io/minimessage-js/)\n\nA TypeScript reimplementation of \nsome [adventure](https://github.com/PaperMC/adventure)\nAPIs for the browser and Node. \nWith this library, you can:\n\n- Deserialize MiniMessage strings into text components\n- Serialize text components into MiniMessage strings\n- **Render text components into HTML**\n\n## Quick Start\n### NodeJS\n```js\nimport { MiniMessage } from \"minimessage-js\";\n// OR: const { MiniMessage } = require(\"minimessage-js\");\n\nconst mini = MiniMessage.miniMessage();\nconst component = mini.deserialize(`\u003crainbow\u003ehello world!\u003c/rainbow\u003e`);\n```\n\n### Browser\n#### Module\n```html\n\u003cspan id=\"output\"\u003e\u003c/span\u003e\n\u003cscript type=\"module\"\u003e\n    import { MiniMessage } from \"minimessage.esm.js\";\n    \n    const mini = MiniMessage.miniMessage();\n    const component = mini.deserialize(`\u003crainbow\u003ehello world!\u003c/rainbow\u003e`);\n    mini.toHTML(component, document.querySelector(`#output`));\n\u003c/script\u003e\n```\n\n#### CommonJS\n```html\n\u003cspan id=\"output\"\u003e\u003c/span\u003e\n\u003cscript src=\"minimessage.umd.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    // All exports are exposed in the \"adventure\" global\n    const { MiniMessage } = window.adventure;\n\n    const mini = MiniMessage.miniMessage();\n    const component = mini.deserialize(`\u003crainbow\u003ehello world!\u003c/rainbow\u003e`);\n    mini.toHTML(component, document.querySelector(`#output`));\n\u003c/script\u003e\n```\n\n## HTML Rendering\nOne utility unique to this library is the HTML renderer.\nTo render a component to HTML, use ``MiniMessage#toHTML``.\nYou may either render to an element in the DOM (also see [DOM Effects](#dom-effects))\nor render to an HTML source string.\n\n\n\u003e [!CAUTION]\n\u003e Passing a string generated by ``toHTML`` into an element's ``innerHTML`` property\n\u003e is unadvisable. While the HTML renderer does properly escape content, this\n\u003e is an inefficient approach that indeed poses a remote security risk.\n\n```ts\n// Render to string\nconst html = mini.toHTML(component); // \u003cspan\u003e...\u003c/span\u003e\n\n// Render to element (browser environment)\nmini.toHTML(component, element);\n\n// Render to element (DOM polyfill, e.g. JSDOM)\nmini.toHTML(component, element, (tag) =\u003e document.createElement(tag));\n```\n\n### DOM Effects\nWhen rendering to a DOM element in a browser environment, the library will\nattempt to bind rendering effects within a \n[requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame) callback.\nIf successful, special rendering is activated.\n\n|    Tag     |                                                                                                    Effect                                                                                                    |\n|:----------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|\n| ``\u003cobf\u003e``  |                                           Binds the \"enchantment table\" font to the document, assigns it to the obfuscated text, and randomizes the text content.                                            |\n| ``\u003chead\u003e`` | Asynchronously renders the appropriate player head using the [CORSjang](https://corsjang.b-cdn.net/) api. The 9 [default skins](https://minecraft.wiki/w/Skin#Default_skins) are also bundled as a fallback. |\n|   others   |                           Sets a ``data-mm-misc`` property on the element containing the text component this element was rendered from. This property is reserved for future use.                            |\n\n### Translations\nThe HTML renderer may be configured to use a specified translation map\nto resolve translatable components (e.g. [\u0026lt;lang\u0026gt;](https://docs.papermc.io/adventure/minimessage/format/#translatable)).\nTo aid in this you may use the ``@minimessage-js/translations`` or ``@minimessage-js/fetch-translations`` library-\nthe former containing a snapshot of all available translation data for synchronous access, and the latter providing\na method to fetch translation data from Mojang APIs at runtime.\n\n```ts\nimport { MiniMessage, Component } from \"minimessage-js\";\nimport { MinecraftTranslations } from \"@minimessage-js/translations\";\n\nconst mini = MiniMessage.builder()\n    .translations(MinecraftTranslations.get(\"en_us\")) // American English\n    .build();\n\nconst translatable = Component.translatable(\"block.minecraft.diamond_block\");\nmini.toHTML(translatable); // \u003cspan\u003eDiamond Block\u003c/span\u003e\n```\n\n## License\n```text\nCopyright 2026 Xavier Pedraza\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n    \nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwasabithumb%2Fminimessage-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwasabithumb%2Fminimessage-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwasabithumb%2Fminimessage-js/lists"}