All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dennisit.vplus.data.utils.MarkdUtils Maven / Gradle / Ivy

There is a newer version: 2.0.8
Show newest version
package com.github.dennisit.vplus.data.utils;

import com.github.dennisit.vplus.data.support.markdown.Html2ImageWrapper;
import com.github.dennisit.vplus.data.support.markdown.MarkDown2HtmlWrapper;
import com.github.dennisit.vplus.data.support.markdown.MarkdownEntity;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;

@Slf4j
public class MarkdUtils {

    public static void markdown2Image(String fileName) {
        try {
            String path = FilenameUtils.getPath(fileName);
            String file = FilenameUtils.getBaseName(fileName);
            String image = "/" + path + file + ".jpg";
            System.out.println(image);
            MarkdownEntity entity = MarkDown2HtmlWrapper.ofFile(fileName);
            Html2ImageWrapper.ofMd(entity).setAutoH(true).build().asFile(image);
        } catch (Exception e) {
            log.error(e.getLocalizedMessage(), e);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy