"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseWithoutEscape = exports.toMarkdownHtml = exports.parseMarkdown = exports.createMarkedRenderer = exports.marked = void 0;
const marked_1 = require("marked");
Object.defineProperty(exports, "marked", { enumerable: true, get: function () { return marked_1.marked; } });
const createMarkedRenderer = () => new marked_1.Renderer();
exports.createMarkedRenderer = createMarkedRenderer;
const parseMarkdown = (value, options, callback) => {
    if (!callback) {
        return marked_1.marked.parse(value, options);
    }
    if (options) {
        marked_1.marked.parse(value, options, callback);
    }
    else {
        marked_1.marked.parse(value, callback);
    }
};
exports.parseMarkdown = parseMarkdown;
const toMarkdownHtml = (value, options) => (0, marked_1.marked)(value, options);
exports.toMarkdownHtml = toMarkdownHtml;
const parseWithoutEscape = (token) => {
    // 这里兼容下 vscode 的写法，vscode 这里没有处理 markdown 语法
    // 否则会出现 (\\) 被解析成 () 期望是 (\)
    if (token.type === 'escape') {
        token.text = token.raw;
    }
    return token;
};
exports.parseWithoutEscape = parseWithoutEscape;
//# sourceMappingURL=marked.js.map