@@ -157,10 +157,35 @@ export class EntityFileParser {
157157
158158 // Find the content for this entity (from this heading to the next ## heading or end of file)
159159 const startIndex = match . index + fullMatch . length ;
160- const nextSectionMatch = content . substring ( startIndex ) . match ( / \n # # / ) ;
161- const endIndex = nextSectionMatch
162- ? startIndex + ( nextSectionMatch . index || 0 )
163- : content . length ;
160+
161+ // Check if the next section is an "## Attributes" heading
162+ // If so, we need to include it in the entity content
163+ let endIndex = content . length ;
164+ const remainingContent = content . substring ( startIndex ) ;
165+ const nextAttributesMatch =
166+ remainingContent . match ( / \n # # A t t r i b u t e s \s * \n / ) ;
167+
168+ if ( nextAttributesMatch && nextAttributesMatch . index !== undefined ) {
169+ // Found "## Attributes" - find the section after that
170+ const afterAttributesStart =
171+ startIndex +
172+ nextAttributesMatch . index +
173+ nextAttributesMatch [ 0 ] . length ;
174+ const afterAttributesContent =
175+ content . substring ( afterAttributesStart ) ;
176+ const nextSectionMatch = afterAttributesContent . match ( / \n # # / ) ;
177+
178+ if ( nextSectionMatch && nextSectionMatch . index !== undefined ) {
179+ endIndex = afterAttributesStart + nextSectionMatch . index ;
180+ }
181+ // If no next section found, use the rest of the file (endIndex already set to content.length)
182+ } else {
183+ // No "## Attributes" section found, look for next ## heading
184+ const nextSectionMatch = remainingContent . match ( / \n # # / ) ;
185+ if ( nextSectionMatch && nextSectionMatch . index !== undefined ) {
186+ endIndex = startIndex + nextSectionMatch . index ;
187+ }
188+ }
164189
165190 const entityContent = content . substring ( startIndex , endIndex ) ;
166191
0 commit comments