devup_editor_markdown/lib.rs
1//! Markdown ↔ [`Document`] conversion for the devup editor.
2//!
3//! Implements [`DocumentExport`] and [`DocumentImport`] from `devup-editor-core`.
4//!
5//! Supported block types: paragraph, heading (h1–h3), todo, list (bullet only),
6//! quote, code (fenced).
7//! Supported marks: bold, italic, code, strike.
8//!
9//! Round-trip is **not** byte-perfect — Markdown is a lossy intermediate.
10
11mod export;
12mod import;
13
14pub use export::Markdown;
15
16use thiserror::Error;
17
18/// Error produced by Markdown import/export.
19///
20/// The current implementation is infallible — every valid `Document`
21/// can be serialised and every byte sequence can be coerced into a
22/// document via best-effort parsing. The `Parse` variant is reserved
23/// for future strict-mode parsing paths where malformed input should
24/// fail fast instead of flattening to paragraphs.
25#[derive(Debug, Error)]
26pub enum MarkdownError {
27 #[error("markdown parse error: {0}")]
28 Parse(String),
29}