Skip to content

segmsh/txt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@segmsh/txt

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.

Installation

npm install @segmsh/txt

Usage

import 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);

Features

  • Structure Preservation: Keeps line structure and blank lines intact.
  • Round-trip: Ensures parsing and stringifying returns the same TXT structure.

Development

Build

npm run build

Test

npm test

License

Apache-2.0

About

TXT processor

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors