htmltoadf 0.1.1

An HTML to Atlassian Document Format (ADF) converter
Documentation

htmltoadf Latest Version Rustc Version 1.58+ htmltoadf

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

[dependencies]
htmltoadf = "0.1.0"

CLI

Binaries

TODO

Docker Image

TODO

Lib

Example Code

use htmltoadf::convert_html_str_to_adf_str;
use serde_json::json;

let converted = convert_html_str_to_adf_str("<h1>Hello World</h1>".to_string());
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);

WASM

TODO

FFI

TODO

Implemented features

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

Testing

Run cargo test from the repository root.

Contributing

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.