MarkdownEditing icon indicating copy to clipboard operation
MarkdownEditing copied to clipboard

Cannot open wiki style links from .md file

Open shriramks opened this issue 6 years ago • 9 comments

  • 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"

shriramks avatar Sep 02 '18 17:09 shriramks

I had a similar problem. It seems that some shortcuts are disabled in the plugin's settings by default: https://github.com/SublimeText-Markdown/MarkdownEditing/blob/9bb79b35f519f65d4c5b65febf94d214c6b48139/Markdown.sublime-settings#L158-L160

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.

josefadamcik avatar Sep 04 '18 09:09 josefadamcik

@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?

shriramks avatar Sep 05 '18 17:09 shriramks

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

felixhao28 avatar Sep 19 '18 09:09 felixhao28

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 }            
    ]    
},

dave-ellis avatar Sep 22 '18 10:09 dave-ellis

@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!

shriramks avatar Sep 22 '18 11:09 shriramks

I installed BracketHightlighter and this did not cause any issues for me. So I don't think you issue is caused or related to it.

Can you clarify whether or not you had any text selected when you invoked the make_reference command? Or whether you had just typed the page name in and the cursor was at the end of the word?

Also what about if you try invoking the make reference command when the cursor is not on a word, does the select page list get displayed then?

Note, the current implementation will not show the select page list when the make reference command is currently on a word. It just converts it to a page reference (i.e. surrounds it in double square brackets).

Additionally if the page name part of an existing page reference is selected, then the select page list is displayed and a different page may be selected.

-=Dave

On Sat, 22 Sep 2018 at 12:20 Shriram Kidambi [email protected] wrote:

@dave-ellis https://github.com/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.keep_centered": false, "mde.keymap_disable.list_back_links": false, "mde.keymap_disable.make_page_reference": fals "mde.keymap_disable.open_page": false, "mde.list_indent_auto_switch_bullet": true,

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//Dropbox/ 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//Dropbox/ 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//Library/Application Support/Sublime Text 3/Installed Packages/MarkdownEditing.sublime-package/open_page.py", line 43, in run File "/Users//Library/Application Support/Sublime Text 3/Installed Packages/MarkdownEditing.sublime-package/wiki_page.py", line 31, in select_page File "/Users//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 [image: 2018-09-22 at 16 48] https://user-images.githubusercontent.com/12730252/45916663-66d68f80-be87-11e8-8dc5-67c37ac859c4.png

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!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SublimeText-Markdown/MarkdownEditing/issues/538#issuecomment-423737241, or mute the thread https://github.com/notifications/unsubscribe-auth/AF0rD8Eh3znO6D4S9OyMG4m-lT_o4c4Tks5udh0LgaJpZM4WWsfk .

dave-ellis avatar Sep 22 '18 15:09 dave-ellis

Can you clarify whether or not you had any text selected when you invoked the make_reference command?

  • No text was selected when I invoked the make_reference command

Or whether you had just typed the page name in and the cursor was at the end of the word?

  • I had just typed in the page name but the cursor was not at the end of the word. Tried making a reference by moving cursor to different positions inside the enclosed brackets.

Also what about if you try invoking the make reference command when the cursor is not on a word, does the select page list get displayed then?

  • Nope, the page list does not get displayed then as well

If possible, can you post a gif/video on how the selection should be done? Think I got your questions right but seeing it will be helpful much.

shriramks avatar Sep 22 '18 16:09 shriramks

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.

dave-ellis avatar Sep 23 '18 10:09 dave-ellis

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

rcorty avatar Apr 15 '20 19:04 rcorty