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

Cannot open wiki style links from .md file #538

Open
shriramks opened this issue Sep 2, 2018 · 9 comments
Open

Cannot open wiki style links from .md file #538

shriramks opened this issue Sep 2, 2018 · 9 comments
Labels
C: wiki Category: wiki functions

Comments

@shriramks
Copy link

shriramks commented Sep 2, 2018

  • Right-click and adding a wiki link to a file in the project folder works
command: make_page_reference
Running MakePageReferenceCommand
Finding matching files for None in /Users/<username>/<path>
Make page reference (402, 402)
Using selected page '<my note here>'
  • Note: The shortcut to add however Super+Shift+D does not work; conflicts with Sublime's own "Duplicate Line"

  • Tried multiple other keys: super+alt+d, super+alt+shift+d, super+alt+shift+j and so on but none worked. The "Duplicate line" kept going as is

  • Cannot open the wiki link once inserted though.

  • None of the shortcuts worked and most didn't log to sublime console

  • One did, no command for selector: noop: but couldn't figure it out

Can someone help me out here? I just want to insert wiki style links into the .md files in my project

Using "Sublime Text 3" on "MacOS High Sierra 10.13.3"

@josefadamcik
Copy link

I had a similar problem. It seems that some shortcuts are disabled in the plugin's settings by default:

"mde.keymap_disable.open_page": true,
// Make page reference
"mde.keymap_disable.make_page_reference": true

You can turn them on in a syntax specific config files:

   // Open the home page
    "mde.keymap_disable.open_home_page": false,
    // Open the journal
    "mde.keymap_disable.open_journal": false,
    // Open the page referenced
    "mde.keymap_disable.open_page": false,
    // Make page reference

Keep in mind, there are more syntaxes managed by the plugin and therefore multiple config files. You can easily access all of them via menu: Preferences -> Package Settings -> MarkdownEditing -> [XYZ] Settings - User.

@shriramks
Copy link
Author

shriramks commented Sep 5, 2018

@josefadamcik Thanks for that!

I use Markdown GFM. I have turned the listed settings ON (making them "false") in:

  • Markdown GFM Settings - User
  • Markdown (Standard) Settings - User
  • Settings, Syntax specific

I am still having an issue. Shortcuts work in creating a wiki reference or opening the file but not as intended. Creating wiki reference does not show the list of files in the project and opening the reference only opens the the selected word (word over cursor) in a new tab.

Am I missing something here?

@felixhao28
Copy link
Contributor

@dave-ellis will you help the fellow wiki users?

@dave-ellis
Copy link
Contributor

Yes, these feature settings have to be enabled. (@felixhao28 Maybe we should add a note in the README).

As for the key-bindings in OSX, I think the open page and make_page_reference is super+shift+d.

Of course, you can add a custom key binding by selecting menu:

Preferences > Package Settings > Markdown Editing > Keybindings - User

and then adding some entries for example the following binds super+shift+z:

{"keys": ["super+shift+z"], "command": "open_page", "context":
    [
        { "key": "setting.mde.keymap_disable.open_page", "operator": "not_equal", "operand": true },
        { "key": "selector", "operator": "equal", "operand": "meta.link.wiki.markdown", "match_all": true }
    ]    
},
{"keys": ["super+shift+z"], "command": "make_page_reference", "context":
    [
        { "key": "setting.mde.keymap_disable.make_page_reference", "operator": "not_equal", "operand": true },
        { "key": "selector", "operator": "equal", "operand": "text.html.markdown", "match_all": true },
        { "key": "selector", "operator": "not_equal", "operand": "meta.link.wiki.markdown", "match_all": true },
        { "key": "selector", "operator": "not_equal", "operand": "markup.underline.link.markdown", "match_all": true }            
    ]    
},

@shriramks
Copy link
Author

shriramks commented Sep 22, 2018

@dave-ellis

Gave both the changed keybinding and enabling feature settings a try and still not able to make/open wiki references

Step-1

  • Enabled following features (rest are default)
"mde.keymap_disable.list_back_links": false,
"mde.keymap_disable.open_page": false,
"mde.keymap_disable.make_page_reference": false,

Step-2

  • Changed the default key binding to "ctrl+shift+l" (which didn't work). Thought there might be a clash so tried with the same keybind as you had posted: "super+shift+z"

Step-3
Now "super+shift+z" is opening the wiki double braces but does not show a list of matching files in the project. This is what I did

  • I have a file called punctuation in the project
  • Invoked make reference command but this did not show me a list of the matching punctuation filename in the project
  • Console logging for this,
command: make_page_reference
Running MakePageReferenceCommand
Finding matching files for None in /Users/<username>/Dropbox/<foldername>
Make page reference (231, 231)
  • Now, I manually typed in the file reference "punctuation" and again made the wiki open reference
  • This was interesting, threw up a bunch of errors in console as shown below
[[punctuation' in: /Users/<username>/Dropbox/<foldername>
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1072, in run_
    return self.run(edit)
  File "/Users/<username>/Library/Application Support/Sublime Text 3/Installed Packages/MarkdownEditing.sublime-package/open_page.py", line 43, in run
  File "/Users/<username>/Library/Application Support/Sublime Text 3/Installed Packages/MarkdownEditing.sublime-package/wiki_page.py", line 31, in select_page
  File "/Users/<username>/Library/Application Support/Sublime Text 3/Installed Packages/MarkdownEditing.sublime-package/wiki_page.py", line 60, in find_files_with_name
  File "./python3.3/re.py", line 161, in search
  File "./python3.3/re.py", line 283, in _compile
  File "./python3.3/sre_compile.py", line 491, in compile
  File "./python3.3/sre_parse.py", line 747, in parse
  File "./python3.3/sre_parse.py", line 359, in _parse_sub
  File "./python3.3/sre_parse.py", line 485, in _parse
sre_constants.error: unexpected end of regular expression
  • This is how my typed in wiki reference looks like as well
    2018-09-22 at 16 48

  • Note: I have the plugin BracketHighlighter but all markdown related brackets in it are set to "false"

I think, something in the way the brackets are rendered are causing this.

Not able to put my finger on it but hope this helps your troubleshooting!

@dave-ellis
Copy link
Contributor

dave-ellis commented Sep 22, 2018 via email

@shriramks
Copy link
Author

shriramks commented Sep 22, 2018 via email

@dave-ellis
Copy link
Contributor

Okay, it definitely sounds like something is not working as it should, since make page reference should select the word under the cursor and surround it with double braces. And if the word under the cursor is already selected and is a valid page reference (i.e. surrounded by braces) then the select page list should be displayed.

I have uploaded a demo of this process in action.

makereferencedemo

Unfortunately I don't own a mac and as such I haven't been able to verify behaviour on OSX.

Note also that I am considering changing this behaviour slightly, so that the select page list would be displayed always as part of make page reference as this may be more intuitive.

@rcorty
Copy link

rcorty commented Apr 15, 2020

I'm having what I believe is the same problem.

@deathaxe deathaxe added the C: wiki Category: wiki functions label Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: wiki Category: wiki functions
Projects
None yet
Development

No branches or pull requests

6 participants