michal-h21 / vim-zettel

VimWiki addon for managing notes according to Zettelkasten method
MIT License
555 stars 72 forks source link

Extend title load function to extract title from headlines (fixes #103) #105

Closed gasperphoenix closed 2 years ago

gasperphoenix commented 3 years ago

If the user is not using the front_matter the plugin was not able to load the title from the first level headline in vimwiki or markdown style. Refer to issue #103

Therefore I extended the zettel#vimwiki#get_title function to load the title from the first level headline in vimwiki or markdown style.

I tested the behavior by deactivating front_matter as follows in my .vimrc and defining a headline using one of the below styles in a new zettel. let g:zettel_options = [{"template" : "~/zettel_template.tpl", "disable_front_matter" : 1}]

vimwiki style = TITLE =

markdown style # TITLE

gasperphoenix commented 3 years ago

I'm wondering if it would make sense to check the used wiki style to distinguish which pattern shall be used to read out the title, e.g. by checking the value of vimwiki#vars#get_wikilocal('syntax') ==? 'markdown' What do you think?

michal-h21 commented 2 years ago

Thanks for this request!

I've added a new function, s:is_markdown, so it is now possible to detect what syntax is used in the Zettelkasten. I've incorporated your code in fd80c82952242b333c76da6bf85a4abd1942e72a, so I think I can close this now.