Skip to main content

incise_core/
lib.rs

1//! incise's core: content-addressed, byte-preserving markdown edits.
2//!
3//! The premise, measured rather than assumed (`bench/FINDINGS.md`): a local
4//! small model editing markdown as text corrupts it. Tables were 19% correct
5//! with 28% data loss when edited directly; the same model driving these ops
6//! scores 60/60 with zero data loss. This crate is the half that has to be
7//! dependable, so its rules are the ones the benchmark forced:
8//!
9//! * **Addressing is semantic** (§5.1) — heading paths, column values, item
10//!   text. Never a line number, which is stale the moment anything above it
11//!   moves.
12//! * **Edits splice bytes** (§5.2). Everything outside the targeted range is
13//!   byte-identical afterwards; the one exception is re-padding an aligned
14//!   table, which is scoped to that table's own lines.
15//! * **Refusals are the product** (§5.3). An [`error::OpError`] message is
16//!   written for a model to recover from in one turn, and 75% of them do.
17//!
18//! `bench/incise_ops.py` is the differential-testing oracle (§9 criterion 7):
19//! where a comment here cites a corpus fixture, that fixture is the test.
20
21pub mod args;
22pub mod describe;
23pub mod error;
24pub mod front;
25pub mod heading;
26pub mod json;
27pub mod list;
28pub mod ops;
29pub mod scan;
30pub mod similar;
31pub mod table;
32
33pub use describe::describe_change;
34pub use error::{OpError, Result};
35pub use front::{find_frontmatter, format_path, parse_path, Entry, Fmt, FrontMatter, Kind, Seg};
36pub use heading::{find_sections, heading_gap, inert_headings, Section};
37pub use ops::dispatch::{apply_op, OPS};
38pub use ops::frontmatter::{
39    describe_frontmatter_change, frontmatter_delete, frontmatter_get, frontmatter_set,
40    render_frontmatter, render_frontmatter_get, FrontKey, FrontState,
41};
42pub use ops::section::{
43    render_section_outline, resolve_section, section_append, section_delete, section_insert,
44    section_outline, section_rename, section_replace_body, section_set_level, SectionAddress,
45    SectionEntry, POSITIONS,
46};
47pub use ops::table::{
48    caption, heading_path, list_tables, render_table_get, render_table_list, render_table_rows,
49    resolve_row, resolve_table, table_add_row, table_delete_row, table_get, table_realign,
50    table_update_cell, Position, TableAddress, TableEntry, TableRows, Values,
51};
52pub use table::{find_tables, Table};