Skip to content
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

Ampersand in heading breaks diary index links #1409

Open
4 tasks done
fancsali opened this issue Jun 5, 2024 · 6 comments · May be fixed by #1436
Open
4 tasks done

Ampersand in heading breaks diary index links #1409

fancsali opened this issue Jun 5, 2024 · 6 comments · May be fixed by #1436
Labels
bug diary header Stuff about header syntax. link Related to link and path creation, modification, use [See #478]

Comments

@fancsali
Copy link

fancsali commented Jun 5, 2024

Prior to submitting a new issue make sure to complete these steps:

  • Include the VimWiki settings from your .vimrc
let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md', 'auto_diary_index': 1, 'diary_caption_level': 6, 'auto_tags': 1, 'listsyms': ' .X'}]
let g:vimwiki_global_ext = 0
let g:vimwiki_auto_header = 1
let g:vimwiki_emoji_enable = 0
  • Include the syntax you are using (default / Markdown / MediaWiki) -- Markdown

  • Provide a detailed description of the problem including steps to reproduce the issue.

    • Enable diary captions/headings to be show on the diary page: set 'diary_caption_level': 6, for example
    • Go to today's note: <Leader>w<Leader>w
    • Create a heading containing and ampersand: ## Ham & Spam
      NOTE: Due to g:vimwiki_auto_header = 1 there'll be a top level ("h1") heading above this with the relevant date)
    • Go back to the index: <Leader>wi
    • Observe the link to the heading in question to be broken: - [Ham __LinkDescription__ Spam](2024-06-05#Ham __LinkUrl__ Spam)
  • Include the output of :VimwikiShowVersion.

Version: 2024.01.24
Os: Linux
Vim: 901
Branch: HEAD
Revision: fde35bb
Date: 2024-01-24 20:14:13 -0700
@fancsali
Copy link
Author

fancsali commented Jun 5, 2024

In concert with #1408 one can generate extremely interesting outcomes...

This in the diary note:

## [Bar   baz](Bar & baz)

## [This & That](This & That)

NOTE: The first link was created by hitting <CR>, which shows another incarnation of this issue of the ampersand tripping up the link generation. (The second one was typed as is by hand).

Will show up as something rather perplexing on the diary index:

        - [[Bar   baz](Bar __LinkDescription__ baz)](2024-06-05#[Bar   baz](Bar __LinkUrl__ baz))
        - [[This __LinkDescription__ That](This __LinkDescription__ That)](2024-06-05#[This __LinkUrl__ That](This __LinkUrl__ That))

@fancsali
Copy link
Author

Adding a bit more context...

Escaping the ampersand in the heading included in diary/2024-08-22.md:

# Fizz \& Buzz

Will produce a nice looking link in diary/diary.md as expected:

- [Fizz & Buzz](2024-08-11#Fizz & Buzz)

However, then the backslash is somewhat of an eyesore.

Based on the above, I suspect, the issue is probably the &-symbol being included in a regex replace unescaped (and thus being interpreted when it should not be.

@brennen brennen added bug link Related to link and path creation, modification, use [See #478] diary header Stuff about header syntax. labels Aug 22, 2024
@brennen
Copy link
Member

brennen commented Aug 22, 2024

Based on the above, I suspect, the issue is probably the &-symbol being included in a regex replace unescaped (and thus being interpreted when it should not be.

Yeah, seems quite likely. I'm guessing a fix will be straightforward, but then again I've thought that before...

@fancsali
Copy link
Author

fancsali commented Aug 22, 2024 via email

@fancsali fancsali linked a pull request Aug 22, 2024 that will close this issue
6 tasks
@fancsali
Copy link
Author

... see #1436!

@brennen
Copy link
Member

brennen commented Aug 22, 2024

Thanks! I'm about to go offline (and off-grid) for a couple of weeks, but I'll try to get that reviewed/merged before too long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug diary header Stuff about header syntax. link Related to link and path creation, modification, use [See #478]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants