mirror of
https://github.com/bitbaum/writingkit.git
synced 2026-12-05 23:58:07 +01:00
* feat(react): ArticleComposer — the shared place to write; assist, drafts and text-edit move into the core Owner, 2026-11-06: the experience belongs to the package. The composer built in BiasLens (title, text, Speak/Photo/Chart, preview, drafts, publish bar) becomes @bitbaum/writingkit/react on chatkit's DictationField, so every product gets a microphone and writing help in the title and the text without building them. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvpWNTLxXNfwUHS7MD * build: rebuild dist against published chatkit 0.23.0; lockfile Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvpWNTLxXNfwUHS7MD --------- Co-authored-by: Claude <noreply@anthropic.com>
28 lines
1.4 KiB
TypeScript
28 lines
1.4 KiB
TypeScript
/**
|
|
* Editing a Markdown text without a DOM: where a snippet or a wrapper lands,
|
|
* and where the caret goes afterwards. Pure, so the same rules run in a test
|
|
* and in the browser.
|
|
*/
|
|
export interface Edit {
|
|
readonly text: string;
|
|
/** Selection to restore after the edit. */
|
|
readonly selectionStart: number;
|
|
readonly selectionEnd: number;
|
|
}
|
|
/** A block (a photo, a chart) goes on its own paragraph, never glued to a sentence. */
|
|
export declare function insertBlock(text: string, start: number, end: number, snippet: string): Edit;
|
|
/** Wrap the selection, or drop in a placeholder that stays selected for typing over. */
|
|
export declare function wrapRange(text: string, start: number, end: number, before: string, after: string, placeholder: string): Edit;
|
|
export declare function countWords(text: string): number;
|
|
/** At 200 words a minute, never less than one. */
|
|
export declare function readingMinutes(text: string): number;
|
|
/** An image as a Markdown figure: alt, source, and a caption carrying its credit. */
|
|
export declare function figureMarkdown(image: {
|
|
alt: string;
|
|
src: string;
|
|
caption?: string;
|
|
credit?: string;
|
|
license?: string;
|
|
}): string;
|
|
export declare const CHART_TEMPLATE = "```chart\n{ \"kind\": \"bar\", \"title\": \"Say what the numbers show\", \"series\": [{ \"name\": \"Series\", \"points\": [[\"2024\", 10], [\"2025\", 14], [\"2026\", 9]] }] }\n```";
|