Gramadoc provides a robust grammar and writing toolkit designed for analyzing text and enhancing rich-text editing experiences. With features like inline suggestions and powerful analysis tools, it supports developers in creating intuitive text editing solutions that improve writing quality.
Gramadoc is a comprehensive grammar and writing toolkit designed to enhance text analysis and facilitate the creation of rich-text editing experiences. Its unique feature set includes inline suggestions that aid users in improving their writing.
@markwylde/gramadoc package serves as the backbone for analyzing grammar, spelling, punctuation, formatting, readability, and structured-text checks, ensuring a thorough assessment of written content.To effectively utilize the core analysis engine, consider the following examples:
import { analyzeHtml, analyzeText, htmlToPlainText } from '@markwylde/gramadoc';
const result = analyzeText('I has a apple.');
console.log(result.matches);
console.log(htmlToPlainText('<p>Hello <strong>world</strong></p>'));
console.log(analyzeHtml('<p>I has a apple.</p>').matches);
@markwylde/gramadoc-react package provides bindings for integrating Gramadoc within React applications. It features a rich-text input component and a background analysis hook, simplifying the implementation of text analysis in web applications.To set up the React environment, use the following snippet:
import { useState } from 'react';
import { GramadocInput, useGrammerAnalysis } from '@markwylde/gramadoc-react';
import '@markwylde/gramadoc-react/styles.css';
export function Editor() {
const [value, setValue] = useState('<p>I has a apple.</p>');
const analysis = useGrammerAnalysis({ value });
return (
<GramadocInput
value={value}
warnings={analysis.warnings}
analysisPlainText={analysis.plainText}
onChange={setValue}
placeholder="Start writing..."
/>
);
}
The repository is structured as a pnpm workspace, which aids in managing dependencies and scripts effectively. Developers can use the following commands to build and test the application:
pnpm install
pnpm dev
pnpm build
pnpm test
Gramadoc is an essential toolkit for anyone looking to improve their writing accuracy and editing capabilities, streamlining the process of generating polished text.
No comments yet.
Sign in to be the first to comment.