fix: csv
This commit is contained in:
@@ -9,7 +9,7 @@ import type { MarkedExtension, Tokens } from "marked";
|
|||||||
function tableToCSV(headers: string[], rows: string[][]): string {
|
function tableToCSV(headers: string[], rows: string[][]): string {
|
||||||
const escapeCell = (cell: string) => {
|
const escapeCell = (cell: string) => {
|
||||||
// 如果单元格包含逗号、换行或引号,需要转义
|
// 如果单元格包含逗号、换行或引号,需要转义
|
||||||
if (cell.includes(',') || cell.includes('\n') || cell.includes('"')) {
|
if (cell.includes(',') || cell.includes('\n') || cell.includes('"') || cell.includes("#")) {
|
||||||
return `"${cell.replace(/"/g, '""')}"`;
|
return `"${cell.replace(/"/g, '""')}"`;
|
||||||
}
|
}
|
||||||
return cell;
|
return cell;
|
||||||
|
|||||||
Reference in New Issue
Block a user