Skip to content

Conversation

sstallion
Copy link
Contributor

This PR is an updated version of #204, which adds support for appending file extensions in Markdown links. This is needed to view wiki files using Markdown viewers such as Gollum and MDwiki. By default, existing behavior is preserved.

@sstallion sstallion changed the title Add support for Markdown link extensions (Updated) Add support for Markdown link extensions Jul 12, 2018
@timokau
Copy link

timokau commented Aug 31, 2018

Merging this would finally make it possible to view and edit vimwiki in an android app (markor).

For anyone who wants to migrate here are two unreadable sed scripts:

  • [[some link]] -> [some link][some link.md]:
    sed -i -e 's/\[\[\([^]]\+\)\]\]/[\1](\1.md)/g' **/*.md
  • [some text](some link) -> [some text][some link.md]:
    sed -i -e 's/\[\([^]]\+\)\](\([^).]\+\))/[\1](\2.md)/g' **/*.md

This may eat your data, don't use it if you don't understand it and don't blame me. Should be executed in the vimwiki dir. I recommend initializing a git repo first and verify the changes afterwards:

cd vimwiki
git init
git add .
git commit -m 'Initial commit'
sed ...
git diff # verify
git reset --hard # in case it went wrong

@elliottw
Copy link

I've been using this for some time. It has really helped with my iOS workflow. However, I think it can't be merged until other functions are changed as well. I haven't tried many, but VimwikiGenerateLinks still produces old style links that do not have extensions.

@sstallion
Copy link
Contributor Author

sstallion commented Oct 11, 2018 via email

@elliottw
Copy link

It's rare that I use them too. I'm just hypothesizing that these changes couldn't be merged if they produce links that are inconsistent with the links that support functions create. I'm not sure what other functions would need changes, probably a search for all functions that create links would be a good start.

julesferreira added a commit to julesferreira/vimwiki that referenced this pull request Feb 26, 2019
julesferreira added a commit to julesferreira/vimwiki that referenced this pull request Feb 26, 2019
julesferreira added a commit to julesferreira/vimwiki that referenced this pull request Feb 26, 2019
@ranebrown
Copy link
Contributor

@sstallion Did you ever look into which functions need modifed such as VimwikiGenerateLinks
I've been added as a maintainer and I'm looking into getting this merged in.

@sstallion
Copy link
Contributor Author

sstallion commented Mar 12, 2019 via email

@ranebrown ranebrown self-assigned this Mar 12, 2019
@ranebrown
Copy link
Contributor

So I think there are 3 issues that need addressed:

  1. VimwikiGenerateLinks does not generate markdown style links and they do not have the .md extension. (VimwikiDiaryGenerateLinks does work correctly though so that could be useful to look at)
  2. VimwikiTOC generates links with a .md extension which should not be present. The links work but don't make sense since they are linking to sections within the document.
  3. VimwikiCheckLinks does not handle markdown style links.

Let me know if you see anything else when you get a chance to look at it.

@hq6 hq6 mentioned this pull request Mar 14, 2019
@ranebrown
Copy link
Contributor

@sstallion when you get a chance to work on this some more please make the pull request against the dev branch instead of master. I did a quick test and the only difference I saw was in autoload/vimwiki/vars.vim. The variables are now set in the function s:read_global_settings_from_user(). You will need to use this format:

 \ 'markdown_link_ext': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},

We are working to make the contributing guidelines more accessible and clear but for now they are only stored on the dev branch. CONTRIBUTING.md

@sstallion sstallion changed the base branch from master to dev March 18, 2019 21:44
@sstallion
Copy link
Contributor Author

@ranebrown PR should be ready to go - this should cover the cases mentioned. I wasn't able to come up with anything else, but I'm happy to take a look if any issues are reported.

@ranebrown
Copy link
Contributor

@sstallion I just tried to test your changes and things aren't working as expected. Following links does not seem to work correctly and the TOC is broken. I haven't had time to look at the code yet.

Are all the commands and general behavior working as expected for you?

@sstallion
Copy link
Contributor Author

sstallion commented Mar 19, 2019 via email

@sstallion
Copy link
Contributor Author

sstallion commented Mar 19, 2019 via email

@ranebrown
Copy link
Contributor

No worries. I think some other things besides the TOC had issues as well such as the diary links. Try to test with different variations such as spaces in the link/header name etc.

@sstallion
Copy link
Contributor Author

@ranebrown Give this a shot - it looks like I was a bit overzealous with checking links in the last changeset. I double checked VimwikiTOC, VimwikiCheckLinks, diaries, and link navigation - all seems to be working correctly.

@ranebrown
Copy link
Contributor

Seems good now! I'm going to spend a bit more time looking this over tonight and get it merged if I don't see any other issues.

@sstallion
Copy link
Contributor Author

sstallion commented Mar 19, 2019 via email

@ranebrown ranebrown merged commit 7d82c75 into vimwiki:dev Mar 20, 2019
theTaikun added a commit to theTaikun/dotfiles that referenced this pull request Mar 22, 2019
As of commit 7d82c75, vimwiki adds extensions to links created by vimwiki. This is important for use with other programs, such as Markor. See vimwiki/vimwiki#529
@add1989
Copy link

add1989 commented Mar 1, 2020

Does anybody know when this can be expected to make it into the master branch?

This was referenced Mar 29, 2020
@ascii78
Copy link

ascii78 commented May 3, 2020

For those trying to use this you need:

let g:vimwiki_markdown_link_ext = 1

in your .vimrc

@andrewlu000
Copy link

This is awesome. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants