Skip to main content

Crate amdc

Crate amdc 

Source
Expand description

Convert documents between Markdown and the Atlassian formats.

Every conversion goes through one typed intermediate representation — see ir — so each format needs a reader and a writer rather than a converter per pair, and any supported format converts to any other.

use amdc::{Format, Options, convert};

let out = convert("# Hello", Format::Markdown, Format::Adf, &Options::default())?;
println!("{}", out.text);
for warning in &out.warnings {
    eprintln!("{warning}");
}

§What a conversion promises

Constructs the target format can’t express are preserved as a tagged payload the reverse conversion re-inflates verbatim (escape), so round-tripping a document through a format that doesn’t understand half of it still gives the document back. Anything genuinely lost is reported on Output::warnings rather than raised, because a caller converting an issue body usually wants the body, not a failure. Callers who want strictness check that the warnings are empty.

An Error means the input couldn’t be read at all.

§Status

Every format in Format is implemented in both directions, so all 36 directed pairs convert.

Re-exports§

pub use error::Error;
pub use error::Warning;
pub use error::WarningKind;
pub use format::Format;
pub use format::Options;
pub use format::UnknownFormat;
pub use format::detect;
pub use ir::Document;

Modules§

error
Failures, and the softer report of what a conversion couldn’t carry over.
escape
The escape hatch: how content one format has no syntax for survives a trip through it.
format
The formats this crate converts between, and the knobs that affect rendering.
ir
The intermediate representation every parser produces and every renderer consumes.
parse
Format-specific readers. Each produces the Document IR and knows nothing about any other format.
render
Format-specific writers. Each consumes the Document IR and knows nothing about any other format.
wiki
What differs between Jira wiki markup and Confluence wiki markup.

Structs§

Output
A rendered document, plus whatever the conversion couldn’t carry over.

Functions§

convert
Convert input from one format to another.
parse
Read input as from.
render
Write doc as to.