File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -368,10 +368,22 @@ Next.js 기반
368
368
필수는 아니지만 파일의 이름을 바꾸고 타이틀을 변경하는 경우 서로의 연결이 끊길수 있기 때문에 사용하면 좋음
369
369
370
370
` ` ` lua
371
- pre_write_note = function(client , note)
371
+ pre_write_note = function(_ , note)
372
372
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
373
373
local content = table.concat(lines, "\n ")
374
- local first_heading = content:match("#%s*(.-)\n ")
374
+ -- 첫 번째 헤딩 찾기 (여러 패턴 시도)
375
+ -- 패턴 1: 문서 시작 부분의 # 헤딩
376
+ local first_heading = content:match("^#%s+(.-)[\r\n ]")
377
+
378
+ -- 패턴 2: 문서 중간의 # 헤딩
379
+ if not first_heading then
380
+ first_heading = content:match("\n #%s+(.-)[\r\n ]")
381
+ end
382
+
383
+ -- 패턴 3: 더 관대한 패턴 (줄 끝이 아닌 어떤 문자든 허용)
384
+ if not first_heading then
385
+ first_heading = content:match("#%s+([^\r\n ]+)")
386
+ end
375
387
if first_heading and #first_heading > 0 then
376
388
first_heading = first_heading:gsub('[/\\ :*?"<>|]', "_"):gsub("^%s*(.-)%s*$", "%1")
377
389
if #first_heading > 0 then
You can’t perform that action at this time.
0 commit comments