Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit a46b43c

Browse files
authored
Merge pull request #432 from M4FFS/fixtables
Fix md parser excluding table headers
2 parents ddd3af3 + 9f17a7e commit a46b43c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

claat/parser/md/parse.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,14 @@ func table(ds *docState) types.Node {
573573

574574
func tableRow(ds *docState) []*types.GridCell {
575575
var row []*types.GridCell
576-
for td := findAtom(ds.cur, atom.Td); td != nil; td = td.NextSibling {
577-
if td.DataAtom != atom.Td {
576+
firstChild := findAtom(ds.cur, atom.Td)
577+
// If there is no Td child found, could be table header so look for Th
578+
if firstChild == nil {
579+
firstChild = findAtom(ds.cur, atom.Th)
580+
}
581+
582+
for td := firstChild; td != nil; td = td.NextSibling {
583+
if td.DataAtom != atom.Td && td.DataAtom != atom.Th {
578584
continue
579585
}
580586
ds.push(td)

0 commit comments

Comments
 (0)