TXT processor for segm.sh. This package parses plain text files into a document (AST + segments) and stringifies them back, treating lines as translatable segments while preserving blank lines.
npm install @segmsh/txtimport TxtProcessor from "@segmsh/txt";
const processor = new TxtProcessor();
const content = "Hello world\n\nThis is a new paragraph.";
const document = processor.parse(content);
// ... modify document segments ...
const newTxtContent = processor.stringify(document);- Structure Preservation: Keeps line structure and blank lines intact.
- Round-trip: Ensures parsing and stringifying returns the same TXT structure.
npm run buildnpm test