annotatedtext - v1.2.1

annotatedtext

Node.js CI

A lightweight JavaScript library for converting markup documents into an annotated text format consumable by LanguageTool as AnnotatedText.

Documentation

For details, please see https://www.prosegrinder.org/annotatedtext.

Installation

npm:

npm install annotatedtext –save

Usage

annotatedtext provides a basic set of types and functions useful for converting markup documents into AnnotatedText.

For example, to convert Markdown to AnnotatedText using the nifty remark-parse parser, you would do:

import { compose } from "annotatedtext";
import { parse } from "remark-parse";
import { unified } from "unified";

const text = "This is a sentence.";
const processor = unified()
.use(remarkparse, options.remarkoptions)
.use(frontmatter, ["yaml", "toml"])
.parse(text);

const annotatedtext = compose(text, parse);
JSON.stringify(annotatedtext);

Running the object through JSON.stringfy() creates a string suitable for passing to LanguageTool's data parameter.

Implemented Parsers

The following packages wrap annotatedtext for specific parsers:

Generated using TypeDoc