@@ -191,6 +191,7 @@ export const tagHandlers: Record<string, TagHandler> = {
191191 } ,
192192 table : {
193193 enter : ( { node, state } ) => {
194+ state . tableRenderedTable = false
194195 if ( isInsideTableCell ( node ) ) {
195196 return '<table>'
196197 }
@@ -204,7 +205,6 @@ export const tagHandlers: Record<string, TagHandler> = {
204205 if ( isInsideTableCell ( node ) ) {
205206 return '<thead>'
206207 }
207- state . tableNeedsThead = true
208208 } ,
209209 exit : ( { node } ) => isInsideTableCell ( node ) ? '</thead>' : undefined ,
210210 } ,
@@ -222,8 +222,8 @@ export const tagHandlers: Record<string, TagHandler> = {
222222 }
223223
224224 // Handle header row separator
225- if ( state . tableNeedsThead ) {
226- state . tableNeedsThead = false
225+ if ( ! state . tableRenderedTable ) {
226+ state . tableRenderedTable = true
227227
228228 // Ensure we have alignments for all columns
229229 const alignments = state . tableColumnAlignments !
@@ -253,10 +253,6 @@ export const tagHandlers: Record<string, TagHandler> = {
253253 return '<th>'
254254 }
255255
256- if ( state . tableNeedsThead !== false ) {
257- state . tableNeedsThead = true
258- }
259-
260256 // Handle alignment
261257 const align = node . attributes ?. align ?. toLowerCase ( )
262258 if ( align ) {
0 commit comments