-
Notifications
You must be signed in to change notification settings - Fork 642
Added optional sub-captions to diary index. #498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The suggested behavior looks a bit muddled to me. When I set this option to 2 but then I have multiple level-1 headers in the diary page, only the first one is taken for the caption and each level-2 header is added as subitem in the diary index, even the ones which are under other level-1 headers.
|
Sounds good, I was aiming for consistency in the caption level as you vary the number of headers in the diary page but I agree that the current behaviour with multiple level-1 headers when set to 2 isn't great. I'm happy with either approach so I'll update it to work as you suggest. |
8bb6ee7
to
fe599b3
Compare
I've updated the pull request to match the behaviour you requested. The commit message has a description of the behaviour:
I didn't document this but there was also the question of what to do about skipped header levels. The caption indentation depth is shifted over so that the smallest indentation depth is one deeper than the main page link. So you won't end up with all of the sub-captions indented 3 deep if all headers in the diary page are at 3rd level instead of 1st. Other than that shift, indentation depth is preserved relative to header level. |
I am a new maintainer and I'm interested in getting this merged. @edlanglois , if you are still interested in this PR, please resolve the conflicts and test against the tip of |
Added the option 'diary_caption_level', which controls the presence of captions in the diary index linking to headers within the diary pages. Possible values: -1: No headers are read from the diary page. 0: The first header from the diary page is used as the caption. There are no sub-captions. 1: Captions are created for headers of level 1 in the diary page. 2: Captions are created for headers up to level 2 in the diary page. etc. When the value is >= 1, the primary caption of each diary page is set to the first header read from that page if it is the unique lowest-level header.
fe599b3
to
bb67438
Compare
Rebased on dev and tested it, everything still works for me. I cleaned up the change a bit as well:
|
@edlanglois, I am not super familiar with the diary feature, so it's possible that I am misusing this, but I was not able to reproduce the intended behavior of this patch. Here's what I tried.
Output:
I expected to see links to all three headers appear in the index page. Am I using it incorrectly? |
The default setting (diary_caption_level=0) preserves the existing behaviour before this change and just takes the first header. Setting diary_caption_level > 0 will show all headers up to that level (e.g. =1 will show the two top level headers only, 2-6 will show all three). With diary_caption_level=1:
|
@edlanglois , I ran |
Oh, the setting is now Also, I set all vimwiki options using the let g:vimwiki_list = [{
\ 'path': '~/some/path/to/vimwiki/',
\ 'diary_caption_level': 1,
\}] |
It's been awhile so I had forgotten how the vimwiki options work. Looks like vimwiki_list is for wiki-local options and |
I have manually merged this PR as 8f5d383. |
This does not appear to work with Markdown syntax vimwiki. I have set
And then Here's my config:
|
(We determined that the issue was from using the master release branch) For anyone else who comes across this: |
Added the option 'diary_caption_level'.
At -1 (the default) the diary index is the same as before.
At level 1, the diary page links have no caption but have a sub-list of
captions linking to the individual top-level headers within the diary
page.
Example:
At level 2, the main caption is the first top-level header and
sub-captions link to 2nd-level headers.
Example:
Inspired by: #154 (comment)
Also related: #30