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.
Key Features
- Core Analysis Engine: The
@markwylde/gramadocpackage serves as the backbone for analyzing grammar, spelling, punctuation, formatting, readability, and structured-text checks, ensuring a thorough assessment of written content.
Usage Examples
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);
- React Bindings: The
@markwylde/gramadoc-reactpackage 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.
React Integration
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..."
/>
);
}
Development Environment
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:
- Install dependencies:
pnpm install
- Start development applications:
pnpm dev
- Build packages and applications:
pnpm build
- Run core package tests:
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.