@@ -547,7 +547,7 @@ function! vimwiki_tasks#open_tasknotes()
547
547
call vimwiki_tasks#insert_task_details (l: uuid )
548
548
" Insert the notes header
549
549
" call append(line('$'), '')
550
- call append (line (' $' ) - 1 , ' ## Notes' )
550
+ call append (line (' $' ) - 1 , <SID> CreateHeader ( ' Notes' ) )
551
551
" put the cursor on the last line
552
552
normal G
553
553
endif
@@ -559,17 +559,18 @@ endfunction
559
559
function ! vimwiki_tasks#insert_task_details (uuid)
560
560
let l: details = vimwiki_tasks#load_full_task (a: uuid )
561
561
call append (0 , ' %% TaskUUID: ' .a: uuid )
562
- " TODO: don't hardcode markdown syntax
563
562
call append (1 , ' ' )
564
- call append (2 , ' # ' .<SID> Strip (l: details .description))
565
- call append (3 , ' ## Task details' )
563
+ call append (2 , <SID> Strip (l: details .description))
564
+ normal 3 gg
565
+ call vimwiki#base#AddHeaderLevel ()
566
+ call append (3 , <SID> CreateHeader (' Task details' ))
566
567
let l: i = 4
567
568
for l: detail in l: details .details
568
569
call append (l: i , l: detail )
569
570
let l: i += 1
570
571
endfor
571
572
call append (0 + l: i , ' ' )
572
- call append (1 + l: i , ' ## Annotations' )
573
+ call append (1 + l: i , <SID> CreateHeader ( ' Annotations' ) )
573
574
let l: i += 2
574
575
for l: annotation in l: details .annotations
575
576
call append (l: i , l: annotation )
@@ -597,8 +598,7 @@ function! vimwiki_tasks#update_tasknote()
597
598
let l: last_modified_line = l: line
598
599
endif
599
600
" check if we already match the Annotations header
600
- " TODO: don't hardcode markdown syntax
601
- if match (l: line , ' \v^## Annotations' ) != -1
601
+ if match (l: line , ' \v^' .<SID> CreateHeader (' Annotations' )) != -1
602
602
let l: last_header_match = 1
603
603
endif
604
604
" check if we are past the last header, then the first empty line
@@ -623,5 +623,12 @@ function! vimwiki_tasks#update_tasknote()
623
623
let &mod = 1
624
624
echo " Updated the task details"
625
625
endif
626
+ endfunction
626
627
628
+ function ! s: CreateHeader (header)
629
+ let hdr = g: vimwiki_rxH .g: vimwiki_rxH .' ' .a: header
630
+ if g: vimwiki_symH
631
+ let hdr .= ' ' .g: vimwiki_rxH .g: vimwiki_rxH
632
+ endif
633
+ return hdr
627
634
endfunction
0 commit comments