{"library":"micro-mdx-parser","title":"Micro MDX Parser","description":"micro-mdx-parser is a lightweight JavaScript parser engineered to efficiently convert Markdown or HTML content into a structured JSON representation. This package is specifically designed for scenarios requiring client-side parsing and component rendering within CMS-like applications, where a full MDX toolchain might be considered excessive. It is built as a fork of the `himalaya` parser, incorporating specific 'MDX-like' adjustments to better align with modern component-based content rendering needs. Currently stable at version 1.1.24, its release cadence is typically infrequent, characteristic of a mature, specialized utility library. Key differentiators include its minimal footprint, versatile compatibility across both browser and server environments, and its focus on generating a parseable JSON AST for programmatic content manipulation, rather than direct HTML output.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install micro-mdx-parser"],"cli":null},"imports":["import { parse } from 'micro-mdx-parser';","const { parse } = require('micro-mdx-parser');","import type { ParserOutput } from 'micro-mdx-parser';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { parse } from 'micro-mdx-parser';\n\nconst markdownContent = `# Hello MDX-like!\n\nThis is a paragraph with **bold** text and an _italic_ word.\n\n<p>HTML can also be parsed.</p>\n\n<MyComponent prop=\"value\" />\n`;\n\nconst htmlContent = `<div><h1>Welcome</h1><p>This is <strong>some</strong> HTML.</p></div>`;\n\nconst parsedMarkdown = parse(markdownContent);\nconst parsedHtml = parse(htmlContent);\n\nconsole.log('Parsed Markdown AST:');\nconsole.log(JSON.stringify(parsedMarkdown, null, 2));\n\nconsole.log('\\nParsed HTML AST:');\nconsole.log(JSON.stringify(parsedHtml, null, 2));\n\n// Example of accessing elements\nif (parsedMarkdown.length > 0 && parsedMarkdown[0].type === 'element' && parsedMarkdown[0].tagName === 'h1') {\n  console.log('\\nFirst element in Markdown is an H1:', parsedMarkdown[0].children[0].content);\n}\n","lang":"javascript","description":"Demonstrates how to import the `parse` function and use it to convert both Markdown and HTML strings into a JSON Abstract Syntax Tree (AST).","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}