File tree 1 file changed +10
-12
lines changed 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -451,24 +451,22 @@ M.not_chat = function(buf, file_name)
451
451
return " resolved file (" .. file_name .. " ) not in chat dir (" .. chat_dir .. " )"
452
452
end
453
453
454
- local lines = vim .api . nvim_buf_get_lines ( buf , 0 , - 1 , false )
455
- if # lines < 5 then
456
- return " file too short "
454
+ local extension = vim .fn . fnamemodify ( file_name , " :e " )
455
+ if extension ~= " md " then
456
+ return " file extension is not .md "
457
457
end
458
458
459
- if not lines [1 ]:match (" ^# " ) then
460
- return " missing topic header"
461
- end
459
+ local lines = vim .api .nvim_buf_get_lines (buf , 0 , - 1 , false )
462
460
463
- local header_found = nil
464
- for i = 1 , 10 do
465
- if i < # lines and lines [i ]:match (" ^- file: " ) then
466
- header_found = true
461
+ local header_break_found = false
462
+ for i = 2 , 20 do
463
+ if i < # lines and lines [i ]:match (" ^%-%-%-%s*$ " ) then
464
+ header_break_found = true
467
465
break
468
466
end
469
467
end
470
- if not header_found then
471
- return " missing file header"
468
+ if not header_break_found then
469
+ return " missing header break "
472
470
end
473
471
474
472
return nil
You can’t perform that action at this time.
0 commit comments