package me.qwq.doghouse.flexmark.ext.lazyimg;

import org.jetbrains.annotations.NotNull;

import com.vladsch.flexmark.html.HtmlRenderer;
import com.vladsch.flexmark.html.HtmlRenderer.Builder;
import com.vladsch.flexmark.parser.Parser;
import com.vladsch.flexmark.util.data.DataKey;
import com.vladsch.flexmark.util.data.MutableDataHolder;

public class LazyImgExtension implements Parser.ParserExtension
, HtmlRenderer.HtmlRendererExtension{
    
    final private static String DEFAULT_MERMAID_LANGUAGE = "mermaid";

    final public static DataKey<String> MERMAID_LANGUAGE = new DataKey<>("MERMAID_LANGUAGE", DEFAULT_MERMAID_LANGUAGE);
    
    private LazyImgExtension() {
    }
    
    public static LazyImgExtension create() {
        return new LazyImgExtension();
    }

    @Override
    public void rendererOptions(@NotNull MutableDataHolder options) {
    }

    @Override
    public void extend(@NotNull Builder htmlRendererBuilder,
            @NotNull String rendererType) {
        if (htmlRendererBuilder.isRendererType("HTML")) {
            htmlRendererBuilder.nodeRendererFactory(new LazyImgNodeRenderer.Factory());
        } else {
            //rendererBuilder.nodeRendererFactory(new GitLabJiraRenderer.Factory());
        }
        
    }

    @Override
    public void parserOptions(MutableDataHolder options) {
        
    }

    @Override
    public void extend(com.vladsch.flexmark.parser.Parser.Builder parserBuilder) {
    }

}
