fix: exporting a table to CSV keeps markdown in the header row (#35299)

When a table header had formatting such as **bold**, `code` or a link, Export to CSV wrote it raw, so the header came out as "**Name**" or "[Docs](https://example.com)" while the rows below were clean. The header now takes its text the same way the rows do.

Fixes #35298
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-30 18:26:55 +04:00
1 parent 571e4e3b52
commit 294c0e988d
1 file changed
+2 -1
@@ -170,7 +170,8 @@
const exportTableToCSVHandler = (token, tokenIdx = 0) => {
// Extract header row text, decode HTML entities, and escape for CSV.
const header = token.header.map(
(headerCell) => `"${decode(headerCell.text).replace(/"/g, '""')}"`
(headerCell) =>
`"${decode(headerCell.tokens.map((token) => token.text).join('')).replace(/"/g, '""')}"`
);
// Create an array for rows that will hold the mapped cell text.