"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.imageToMarkdown = imageToMarkdown;
const const_1 = require("./const.js");
function imageToMarkdown({ renderExtra } = {}) {
    return (state, node) => {
        const { attrs } = node;
        let result = '![';
        if (attrs[const_1.ImageAttr.Alt])
            result += state.esc(attrs[const_1.ImageAttr.Alt]);
        result += '](';
        if (attrs[const_1.ImageAttr.Src])
            result += state.esc(attrs[const_1.ImageAttr.Src]);
        if (attrs[const_1.ImageAttr.Title])
            result += ` ${state.quote(attrs[const_1.ImageAttr.Title])}`;
        if (renderExtra)
            result += renderExtra(state, node);
        result += ')';
        state.write(result);
    };
}
//# sourceMappingURL=utils.js.map
