htmltoadf is an HTML to Atlassian Document Format (ADF) converter written in Rust.
The library can be used in several different ways: * As a command line binary (either directly on a compatible host or using Docker) * Included as a library within a Rust project * Called from a different language or environment (e.g. C, JavaScript, Ruby, PHP, .NET, ) using FFI * Called as a Web Assembly (wasm) module
toml
[dependencies]
htmltoadf = "0.1.0"
TODO
TODO
```rust use htmltoadf::converthtmlstrtoadfstr; use serdejson::json;
let converted = converthtmlstrtoadfstr("Hello World
".tostring());
let expected = json!({
"version": 1,
"type": "doc",
"content": [
{
"type": "heading",
"attrs": {
"level": 1
},
"content": [
{
"type": "text",
"text": "Hello World"
}
]
}
]
}).to_string();
assert_eq!(expected, converted); ```
TODO
TODO
This converter only implements a subset of possible mappings between HTML and ADF. The following conversions are implemented: * Headings * Images * Lists (ordered and unordered) * Tables * Text and Paragraphs * Code
Run cargo test
from the repository root.
Bug reports and pull requests are welcome on GitHub at https://github.com/wouterken/htmltoadf. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.