A lightweight JavaScript library based on annotatedtext and rehype-parse for converting HTML documents into an annotated text format consumable by LanguageTool as AnnotatedText.
For details, please see https://www.prosegrinder.com/annotatedtext-rehype.
This package is
ESM only.
Node 12+ is needed to use it, and it must be import
ed instead of require
d.
npm:
npm install annotatedtext-rehype --save
Use build
to convert valid HTML into
AnnotatedText.
import { build } from "annotatedtext-rehype";
const text = "<p>Some <b>bold</b> text.</p>";
const annotatedtext = build(text);
const ltdata = JSON.stringify(annotatedtext);