Skip to main content

Crate incise_core

Crate incise_core 

Source
Expand description

incise’s core: content-addressed, byte-preserving markdown edits.

The premise, measured rather than assumed (bench/FINDINGS.md): a local small model editing markdown as text corrupts it. Tables were 19% correct with 28% data loss when edited directly; the same model driving these ops scores 60/60 with zero data loss. This crate is the half that has to be dependable, so its rules are the ones the benchmark forced:

  • Addressing is semantic (§5.1) — heading paths, column values, item text. Never a line number, which is stale the moment anything above it moves.
  • Edits splice bytes (§5.2). Everything outside the targeted range is byte-identical afterwards; the one exception is re-padding an aligned table, which is scoped to that table’s own lines.
  • Refusals are the product (§5.3). An error::OpError message is written for a model to recover from in one turn, and 75% of them do.

bench/incise_ops.py is the differential-testing oracle (§9 criterion 7): where a comment here cites a corpus fixture, that fixture is the test.

Re-exports§

pub use describe::describe_change;
pub use error::OpError;
pub use error::Result;
pub use front::find_frontmatter;
pub use front::format_path;
pub use front::parse_path;
pub use front::Entry;
pub use front::Fmt;
pub use front::FrontMatter;
pub use front::Kind;
pub use front::Seg;
pub use heading::find_sections;
pub use heading::heading_gap;
pub use heading::inert_headings;
pub use heading::Section;
pub use ops::dispatch::apply_op;
pub use ops::dispatch::OPS;
pub use ops::frontmatter::describe_frontmatter_change;
pub use ops::frontmatter::frontmatter_delete;
pub use ops::frontmatter::frontmatter_get;
pub use ops::frontmatter::frontmatter_set;
pub use ops::frontmatter::render_frontmatter;
pub use ops::frontmatter::render_frontmatter_get;
pub use ops::frontmatter::FrontKey;
pub use ops::frontmatter::FrontState;
pub use ops::section::render_section_outline;
pub use ops::section::resolve_section;
pub use ops::section::section_append;
pub use ops::section::section_delete;
pub use ops::section::section_insert;
pub use ops::section::section_outline;
pub use ops::section::section_rename;
pub use ops::section::section_replace_body;
pub use ops::section::section_set_level;
pub use ops::section::SectionAddress;
pub use ops::section::SectionEntry;
pub use ops::section::POSITIONS;
pub use ops::table::caption;
pub use ops::table::heading_path;
pub use ops::table::list_tables;
pub use ops::table::render_table_get;
pub use ops::table::render_table_list;
pub use ops::table::render_table_rows;
pub use ops::table::resolve_row;
pub use ops::table::resolve_table;
pub use ops::table::table_add_row;
pub use ops::table::table_delete_row;
pub use ops::table::table_get;
pub use ops::table::table_realign;
pub use ops::table::table_update_cell;
pub use ops::table::Position;
pub use ops::table::TableAddress;
pub use ops::table::TableEntry;
pub use ops::table::TableRows;
pub use ops::table::Values;
pub use table::find_tables;
pub use table::Table;

Modules§

args
Runtime validation of tool arguments, ported from bench/incise_ops.py.
describe
What an op did to a document, derived from the document.
error
A failure whose message is handed straight back to a model.
front
Frontmatter parsing — the fourth sibling of crate::table, crate::list and crate::heading, and the port of bench/mdfront.py.
heading
Heading and section structure.
json
A JSON value, a parser for it, and Python’s repr of one.
list
Markdown list location and shape — the list family’s crate::table.
ops
One module per op family, in the build order §11 ranked by measured harm.
scan
Line-level scanning shared by every op family.
similar
Python difflib, ported: close-match ranking and the opcode-level diff.
table
GFM table location and geometry.