Crates.io | madfun |
lib.rs | madfun |
version | 0.1.2 |
created_at | 2025-06-27 19:02:08.997489+00 |
updated_at | 2025-06-30 15:39:42.177023+00 |
description | Autogenerate Atlassian Document Format (ADF) from Markdown |
homepage | https://git.sr.ht/~yikesh/madfun |
repository | https://git.sr.ht/~yikesh/madfun |
max_upload_size | |
id | 1729245 |
size | 65,972 |
madfun
WARNING: This crate is incomplete, and does not include full support for all Markdown blocks. Known working Markdown primitives:
Would you like to use Ma
rkdown to post A
tlassian D
ocument F
ormatted
content while still having fun
? Then this tool's for you!
madfun
works by taking input in
Markdown, either as text or a parsed
abstract syntax tree
(AST) and converting
it to an adf:Node
tree that conforms to Atlassian's
ADF.
This type implements serde's Serialize
and Deserialize
traits, so it's
easy to convert to a JSON representation via serde_json
.
Once you've got that, it should be simple (lol) to use any HTTP or Atlassian client to send it wherever it's going.
The core of madfun
is the [ToAdf
] trait; this exposes methods for
converting text or pre-parsed Markdown (via the markdown
crate) into a
serde_json::Value
that can then be serialized as you desire.
If you have Markdown text:
let adf = madfun::from_str(
"Here is my Markdown content",
).unwrap();
If you've already got the Markdown parsed into a markdown::mdast::Node
,
then you can use the infallible [ToAdf::to_adf
] method:
use madfun::ToAdf;
let mdast = markdown::to_mdast(
"Here is my Markdown content",
&markdown::ParseOptions::default(),
).unwrap();
let adf = mdast.to_adf();
madfun
is currently unidirectional; it takes Markdown and renders ADF
JSON. Unfortunately, it can't (yet?) take ADF as returned from the Atlassian
APIs and convert it back to Markdown, though in theory this should be doable
(if not actually isomorphic).
madfun
is dual-licensed as MIT or Apache-2.0. Have fun.
License: MIT OR Apache-2.0