import { ImageAttr } from "./const.js";
export function imageToMarkdown({ renderExtra } = {}) {
    return (state, node) => {
        const { attrs } = node;
        let result = '![';
        if (attrs[ImageAttr.Alt])
            result += state.esc(attrs[ImageAttr.Alt]);
        result += '](';
        if (attrs[ImageAttr.Src])
            result += state.esc(attrs[ImageAttr.Src]);
        if (attrs[ImageAttr.Title])
            result += ` ${state.quote(attrs[ImageAttr.Title])}`;
        if (renderExtra)
            result += renderExtra(state, node);
        result += ')';
        state.write(result);
    };
}
//# sourceMappingURL=utils.js.map
