@@ -228,14 +228,19 @@ func trimRightSpace(str string) string {
228
228
// checkMultiLineString detects and updates the inCodeBlock state.
229
229
// For languages like Nim, Mojo, Python and Starlark.
230
230
func checkMultiLineString (trimmedLine string , inCodeBlock bool ) (bool , bool ) {
231
+ trimmedLine = strings .TrimPrefix (trimmedLine , "return " )
231
232
foundDocstringMarker := false
233
+ // Check for special syntax patterns that indicate the start of a multiline string
232
234
if trimmedLine == "\" \" \" " || trimmedLine == "'''" { // only 3 letters
233
235
inCodeBlock = ! inCodeBlock
234
236
foundDocstringMarker = true
235
- } else if strings .HasPrefix (trimmedLine , "\" \" \" " ) && strings .HasSuffix (trimmedLine , "\" \" \" " ) { // this could be 6 lte
237
+ } else if strings .HasSuffix (trimmedLine , " = \" \" \" " ) || strings .HasSuffix (trimmedLine , " = '''" ) {
238
+ inCodeBlock = true
239
+ foundDocstringMarker = true
240
+ } else if strings .HasPrefix (trimmedLine , "\" \" \" " ) && strings .HasSuffix (trimmedLine , "\" \" \" " ) { // this could be 6 letters
236
241
inCodeBlock = false
237
242
foundDocstringMarker = true
238
- } else if strings .HasPrefix (trimmedLine , "'''" ) && strings .HasSuffix (trimmedLine , "'''" ) { // this could be 6 lettersre
243
+ } else if strings .HasPrefix (trimmedLine , "'''" ) && strings .HasSuffix (trimmedLine , "'''" ) { // this could be 6 letters
239
244
inCodeBlock = false
240
245
foundDocstringMarker = true
241
246
} else if strings .HasPrefix (trimmedLine , "\" \" \" " ) || strings .HasPrefix (trimmedLine , "'''" ) { // this is more than 3 ts
@@ -244,7 +249,7 @@ func checkMultiLineString(trimmedLine string, inCodeBlock bool) (bool, bool) {
244
249
foundDocstringMarker = true
245
250
}
246
251
} else if strings .HasSuffix (trimmedLine , "\" \" \" " ) || strings .HasSuffix (trimmedLine , "'''" ) { // this is more than 3 ts
247
- if ( strings .Count (trimmedLine , "\" \" \" " ) % 2 != 0 || strings .Count (trimmedLine , "'''" ) % 2 != 0 ) {
252
+ if strings .Count (trimmedLine , "\" \" \" " )% 2 != 0 || strings .Count (trimmedLine , "'''" )% 2 != 0 {
248
253
inCodeBlock = ! inCodeBlock
249
254
}
250
255
if inCodeBlock {
0 commit comments