@localizesh/processor-mdx
v1.0.0
Published
MDX processor for the localize.sh ecosystem. Built on top of `@localizesh/processor-md`, this package extends Markdown processing with MDX support — parsing MDX files into a localization-friendly AST (Abstract Syntax Tree) and stringifying them back, pres
Downloads
173
Readme
Localize.sh MDX Processor
MDX processor for the localize.sh ecosystem. Built on top of @localizesh/processor-md, this package extends Markdown processing with MDX support — parsing MDX files into a localization-friendly AST (Abstract Syntax Tree) and stringifying them back, preserving structure while allowing content extraction.
Installation
npm install @localizesh/processor-mdxUsage
import MdxProcessor from "@localizesh/processor-mdx";
const processor = new MdxProcessor();
const mdxContent = '# Hello world';
// Parse into a Document (AST + Segments)
const document = processor.parse(mdxContent);
// ... modify document segments ...
// Stringify back to MDX
const newMdxContent = processor.stringify(document);Features
- MDX Support: Handles JSX components, imports, and exports within Markdown.
- Structure Preservation: Maintains the original structure of the MDX document.
- Round-trip: Ensures that parsing and then stringifying results in the original MDX structure, preserving as much formatting as possible.
Development
Build
npm run buildTest
npm test