fix(blog): restore live-site tables in migrated articles
- restore semantic table markup across English, Spanish, and Arabic posts - match live-site table styling and caption formatting - preserve tables and normalize contained links and assets during extraction
This commit is contained in:
@@ -97,8 +97,15 @@ function extractRecord(file, html) {
|
||||
const src = localizeAsset($(element).attr('src'));
|
||||
if (src) $(element).attr('src', src);
|
||||
});
|
||||
const tables = [];
|
||||
body.find('table').each((_, element) => {
|
||||
const token = `__TABLE_${tables.length}__`;
|
||||
tables.push($(element).prop('outerHTML'));
|
||||
$(element).replaceWith(`\n\n${token}\n\n`);
|
||||
});
|
||||
const markdown = contentMarkdown(
|
||||
turndown.turndown(body.html() || '').replace(/\n{3,}/g, '\n\n').trim(),
|
||||
tables.reduce((output, table, index) => output.replaceAll(`__TABLE_${index}__`, table),
|
||||
turndown.turndown(body.html() || '').replace(/\n{3,}/g, '\n\n').trim()),
|
||||
isBlogFile(file)
|
||||
);
|
||||
return { file, lang, url, title, description, h1, image, alt, date, markdown };
|
||||
|
||||
Reference in New Issue
Block a user