MarkdownEditing icon indicating copy to clipboard operation
MarkdownEditing copied to clipboard

Can't make wiki page references in most contexts

Open noah-arroyo opened this issue 7 months ago • 4 comments

I'm unable to create wiki page references in many contexts.

FWIW, this has been an issue for at least a month, but I haven't had time to report it until now. (In case that timetable helps you identify the problem.)

1. If I attempt to make the reference within text, with one space on both sides of the caret/cursor, the double brackets appear on the correct line, where the caret was, but the spaces have been relocated into the space where the reference would be, and also no dropdown appears to let me search and select from my files. Example:

some text, before ref

some[[ ]]text, after ref

2. If I make the reference after text, then the closing double brackets jump to the subsequent line — the caret jumps to that line too, into column 1 — and no file-search dropdown appears. Note that in the example below, there is a space following (to the right of) "before ref"; I've attempted to make the reference when the caret was positioned after that space, in column 23. In the output, the space was relocated to occur following the opening brackets.

some text, before ref

some text, after ref[[ ]]

3. This happens even if there are many spaces separating the preceding text from the location of the attempted reference. In the following example, I've places an "x" on the line of the "before ref" text just to visually show the presence of 10 spaces. I then deleted the "x", placed the caret where the "x" had been and then used the hotkey to make a reference. As in the previous example, all 10 spaces were relocated to the right of the opening brackets

some text, before ref x

some text, after ref[[ ]]

4. I see similar behavior if I try to make the reference within an item of an ordered or unordered list. Here are examples of the output:

1.[[ ]]

-[[ ]]

5. It even happens if I make a reference on a fresh line, with the caret positioned to the right of a single space. Output:

[[ ]]

All of the above behavior occurs regardless of whether I'm using a hotkey or right-click popup menu to make a reference.

Making a reference works fine in a fresh line with no content or spaces at all.

I'm on Ubuntu 24.04. Thanks so much!

noah-arroyo avatar May 23 '25 22:05 noah-arroyo

The mde_make_page_reference provided by MarkdownEditing is designed to select an existing word under caret and surround it with [[ ]]. A list of available page files containing the word is displayed via quick panel.

It is not designed to add new page references between two words.

This behavior hasn't changed since Wiki support was added and behaves the same for all ST builds.

The behavior described is expected as it just expands the region under caret to neighbouring word separators, which technically selects all whitespace characters between words.

deathaxe avatar May 24 '25 09:05 deathaxe

Ah, that makes sense. I can easily work with the tool in the manner you describe, going forward. Thank you for explaining it to me!

I do think it'd elevate this function if when the user hit the hotkey, or even just typed [[ (causing the closing brackets to auto-populate), the popup list of available files became visible so that the user could search them and select a reference. Same for being able to do that between words — or anywhere in the file, really. This is how Obsidian and Zettlr handle it, and I think it's both intuitive and useful. Those two apps have probably also shifted user expectations (mine included) from where they were when wiki support was originally added to ST / MarkdownEditing. But I also realize that it'd be work to augment this functionality, and it'd only improve what it already a very, very good system. Thanks for your attention @deathaxe !

noah-arroyo avatar May 24 '25 19:05 noah-arroyo

Well, the strength of open source software is, anybody can contribute.

I've tweaked related functions to enable adding new wiki links between words, but the wiki system is not one of my top priority parts, currently. Writing/maintaining wikis is not my domain.

deathaxe avatar May 25 '25 08:05 deathaxe

Hell yeah. Thank you again.

noah-arroyo avatar May 25 '25 15:05 noah-arroyo