"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderMarkdownCodeBlock = renderMarkdownCodeBlock;
exports.renderMarkdownDetails = renderMarkdownDetails;
function renderMarkdownCodeBlock(content, infoString) {
    const fence = selectMarkdownFence(content);
    return [`${fence}${infoString ?? ""}`, content, fence];
}
function renderMarkdownDetails(input) {
    return [
        "<details>",
        `<summary>${escapeHtmlText(input.summary)}</summary>`,
        "",
        ...input.lines,
        "",
        "</details>",
    ];
}
function selectMarkdownFence(content) {
    let fence = "```";
    while (content.includes(fence)) {
        fence += "`";
    }
    return fence;
}
function escapeHtmlText(value) {
    return value
        .replaceAll("&", "&amp;")
        .replaceAll("<", "&lt;")
        .replaceAll(">", "&gt;");
}
