ElyMark: tables compare by alignment and cell source, in quotes and lists too; rewritten cells stay raw (R2.13)

This commit is contained in:
ZacharyZhang-NY committed 2026-10-09 05:15:42 -04:00
1 parent 844d98559b
commit 44a61443fa
5 files changed
+46 -7

No files matched your search

+2 -1
View File
@@ -36,7 +36,8 @@ export function style(text) {
if (node.depth <= 2) vote('setext', head[0] !== '#')
break
case 'table': {
const rows = text.slice(at, node.position.end.offset).split('\n').map((row) => row.trim())
// Row nodes leave out quote and list prefixes.
const rows = node.children.map((row) => text.slice(row.position.start.offset, row.position.end.offset).trim())
const padded = /\| /.test(rows[0])
const cells = rows.flatMap((row) => row.replace(/^\||\|$/g, '').split('|'))
const inner = (cell) => (padded ? cell.replace(/^ | $/g, '') : cell)