Markdown processor for segm.sh. This package parses Markdown files into a document (AST + segments) and stringifies them back, preserving structure while allowing content extraction.
npm install @segmsh/mdimport MdProcessor from "@segmsh/md";
const processor = new MdProcessor();
const mdContent = "# Hello world";
const document = processor.parse(mdContent);
// ... modify document segments ...
// Stringify back to Markdown
const newMdContent = processor.stringify(document);- Structure Preservation: Maintains the original structure of the Markdown document.
- Round-trip: Ensures that parsing and then stringifying results in the original Markdown structure, preserving as much formatting as possible.
npm run buildnpm test