Skip to content

Latest commit

 

History

History
77 lines (63 loc) · 2.31 KB

README.md

File metadata and controls

77 lines (63 loc) · 2.31 KB

MD2odt

Build Status codecov

MD2odt is a easy to use library for converting Markdown to OpenDocument (.odt).

Features

  • Input can be either plain Markdown file or ZIP file with one Markdown file and resources (images)
  • Support for complete Markdown syntax
  • Support for various Markdown extensions (turned off by default)
    • Autolinks
    • Emoji :octopus:
    • Strikethrough ~~something wrong~~
    • Subscript H~2~O
    • Superscript x^2^
    • Tables
    • Table of contents
  • Syntax highlighting (all common languages)
  • Support for both local and remote images (PNG, JPG, GIF, BMP, SVG)
  • Support for templates – template is a regular ODF file with custom styles, front page, header, footer, etc.

Example

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Dependency:

<dependency>
    <groupId>com.github.abcBHM</groupId>
    <artifactId>MD2odt</artifactId>
    <version>master-SNAPSHOT</version>
</dependency>

Source code

import cz.zcu.kiv.md2odt.MD2odt;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;

public class Example {

    public static void main(String... args) throws IOException {
        MD2odt.converter()
                .setInput(Paths.get("example.md"), StandardCharsets.UTF_8)
                .setTemplate(Paths.get("template.odt"))
                .setOutput(Paths.get("result.odt"))
                .enableAllExtensions()
                .convert();
    }
}

Example files

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.