import type { FileComments } from "../types" function escapeXml(text: string): string { return text .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'") } export function buildCommentsXml(fileCommentsList: FileComments[]): string { const lines: string[] = [] for (const fc of fileCommentsList) { lines.push(``) for (const comment of fc.comments) { lines.push(`\t${escapeXml(comment.text)}`) } lines.push(``) } return lines.join("\n") }