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

Following links doesn't search the repository in gfm-mode #174

Closed
alelog opened this issue Oct 17, 2016 · 5 comments
Closed

Following links doesn't search the repository in gfm-mode #174

alelog opened this issue Oct 17, 2016 · 5 comments

Comments

@alelog
Copy link

alelog commented Oct 17, 2016

I'm just starting to use Markdown mode for editing a GitHub project's Wiki in a local clone and it's a great improvement over my previous process--thank you!

To keep files organized, I maintain significant hierarchy in my Wiki directories. GitHub's Gollum Wiki, searches for files that match the link anywhere in the Wiki git repository. In gfm-mode, trying to follow Gollum links opens a new buffer in the directory of the buffer containing the link. I tried setting markdown-wiki-link-search-parent-directories to non-nil but it doesn't appear to search the whole repository.

Thank you for considering this (or telling me what I'm doing wrong if this functionality is already supported).

Below is a snippet of Gollum Wiki documentation at
https://github.com/gollum/gollum/wiki#linking-internal-pages

Linking internal pages

The following tag will create a link to another Gollum page:

[[cannonical-page-filename]]

Cannonical page filename is the page's filename, but after applying these rules:

  • Extension is tossed away.
  • Spaces (U+0020) are replaced with dashes (U+002D).
  • Forward slashes (U+002F) are replaced with dashes (U+002D).

Examples:

  • [[J. R. R. Tolkien]] will reference the J.-R.-R.-Tolkien.ext page
  • [[Movies / The Hobbit]] will reference the Movies---The-Hobbit.ext page
  • [[モルドール]] will reference the モルドール.ext page

The referenced page may exist anywhere in the git repository. Gollum will search for it and link the first such page that it finds.

@alelog alelog changed the title Following links doesn't support Gollum Wiki GuFile-name canonicalization differs from Gollum Following links doesn't search the repository in gfm-mode Oct 17, 2016
@syohex
Copy link
Collaborator

syohex commented Oct 19, 2016

Did you set non-nil value to markdown-enable-wiki-links ?

@alelog
Copy link
Author

alelog commented Oct 19, 2016

Thank you for the suggestion. I don't see that as a customization variable in emacs. I tried just setting it to t, just in case, and that didn't help. Do I need to switch to a development version to get that setting?

@syohex
Copy link
Collaborator

syohex commented Oct 20, 2016

No.

    [[J. R. R. Tolkien]] will reference the J.-R.-R.-Tolkien.ext page
    [[Movies / The Hobbit]] will reference the Movies---The-Hobbit.ext page
    [[モルドール]] will reference the モルドール.ext page

I think 1st and 3rd example works. While 2nd does not works when markdown-enable-wiki-links is non-nil.

@alelog
Copy link
Author

alelog commented Oct 20, 2016

Sorry, I wasn't clear. I'm happy enough with how the character normalization works now (after discovering that I should use gfm-mode or customize markdown-link-space-sub-char). The example [[Movies / The Hobbit]] doesn't involve any directories--it's just showing that spaces, slashes, etc. are all normalized to a single '-'.

My big issue is not finding pages in different directories of the Wiki. If I have Home.md with content [[Link]] but Link.md is in a subdirectory, gfm-mode and markdown-mode open a new buffer in the same directory as Home.md instead of finding Link.md in the subdirectory.

Here's the relevant snippet from Gollum's documentation:

The referenced page may exist anywhere in the git repository. Gollum will search for it and link the first such page that it finds.

@jrblevin
Copy link
Owner

I added a markdown-wiki-link-search-subdirectories option, which is disabled by default in markdown-mode but enabled by default in gfm-mode. I also added some test cases, but let me know if for some reason it doesn't work as expected.

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

No branches or pull requests

3 participants