Skip to content

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

License

Notifications You must be signed in to change notification settings

prosegrinder/annotatedtext

Repository files navigation

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:

About

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

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •