Files
Marcos Paulo e8c8c06d1e
ci / ci (macos-latest) (push) Has been cancelled
ci / ci (ubuntu-latest) (push) Has been cancelled
ci / ci (windows-latest) (push) Has been cancelled
feat: smart folder model, media time fragments, link card URL guard (MiniMax); specs for 10 more gaps (Codex) and the registry with bloat measurements
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 14:41:26 -03:00

2.5 KiB

TASK slide-model: lossless Markdown slide ranges (Markdown slides)

Runs through OpenCode (specs/agents/opencode-runbook.md is attached automatically). Task 1 of specs/plugins-parity/markdown-slides/tasks.md (rank 41, supersedes 19).

OWNS

  • crates/markdown/src/slides.rs (new, FIRST; unit tests inside).
  • crates/markdown/src/lib.rs (module and public exports).
  • crates/markdown/src/error.rs only a narrow deck-size error if needed.

FILES TO OPEN

  • specs/plugins-parity/markdown-slides/spec.md D1 and tasks.md task 1.
  • crates/markdown/src/lib.rs, crates/markdown/src/frontmatter/mod.rs, crates/markdown/src/scanning/fences.rs, crates/markdown/src/scanning/common.rs.
  • crates/markdown/Cargo.toml read only: existing pulldown-cmark parser; no dependency needed.

GOAL / API

Write crates/markdown/src/slides.rs in SECOND tool call (compiling stub plus one failing test first).

pub struct Slide { pub range: std::ops::Range<usize> }
pub struct Deck { pub slides: Vec<Slide> }
pub fn parse_deck(source: &str) -> Result<Deck>;

Use existing offset parser, frontmatter boundary and protected spans. Only root-level CommonMark thematic-break event for exact unindented ---, with body boundary/blank lines around it, becomes separator. Preserve explicit empty slides and original UTF-8 byte ranges; remove frontmatter/separators from slide ranges without rewriting source. Fenced code, quote/list content, setext underline, comments, math and HTML protected regions do not split. Limit source 2 MiB and deck 500 slides; reject excess, never truncate. Empty/frontmatter-only note yields one empty slide. No IO/new crate/dependency.

TESTS

D1 fixtures: frontmatter, setext, code/comments/math/HTML, quote/list, alternate rules, unclosed fence/comment, CRLF, Unicode, empty/body-only/frontmatter-only, leading/trailing/repeated valid boundaries, missing final newline, exact/over byte and slide caps. Assert every source.get(range) succeeds and concatenation/ranges retain expected bytes; original source unchanged.

VERIFY

export PATH="$HOME/.cargo/bin:$PATH"
cargo test -p notescraft-markdown slides
cargo clippy -p notescraft-markdown --all-targets -- -D warnings
rustfmt --edition 2024 crates/markdown/src/slides.rs crates/markdown/src/lib.rs crates/markdown/src/error.rs

DO NOT

Edit Cargo files, add dependency, read/write files, touch engine/UI, split raw source on ---, silently drop empty slides, implement rank19 independently. User-facing behavior belongs to subsequent engine commands.