Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/cli/actions/gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,19 @@ async function genFull(sitemapUrl) {
emDelimiter: '*',
hr: '---',
});
// Configure Turndown for table content
const turndownServiceForTable = new TurndownService({
codeBlockStyle: 'fenced',
headingStyle: 'atx',
bulletListMarker: '-',
emDelimiter: '*',
hr: '---',
});
// add rule for table content
turndownService.addRule('table', {
filter: 'table',
replacement: function(content, node) {
return '\n' + turndownService.turndown(node.outerHTML) + '\n';
return '\n' + turndownServiceForTable.turndown(node.outerHTML) + '\n';
}
Comment on lines 280 to 284
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turndownServiceForTable.turndown(node.outerHTML) re-parses and re-processes the entire table even though Turndown already computed the converted child content and passed it in as content. This adds unnecessary work for large TOCs/tables; consider returning the provided content (optionally wrapped in newlines) instead of invoking another .turndown() call.

Copilot uses AI. Check for mistakes.
});
let output = '';
Expand Down