pajoma/vscode-journal

Better Wiki Links

pajoma opened this issue · 2 comments

Test to support simple wiki links, e.g. [[a-link-is-here]] or [[A Link Is here]] (with snake case normalization)

Required features:

  • Snippet to create a link (see #90)
  • Ctrl+LM should open (and create) the linked page
  • [[cursor here]] should show a dropdown list of possible notes (in journal namespace and scopes)

Problem here: we lose markdown compatibility.

Current syntax is:

- a file [link](../../notes/some-note.md)

Proposed syntax is (for the same file)

- a file link [[../../notes/some-note.md]]

and if we are able to guarantee uniquess of filenames in all scopes it could be

- a file link [[some-note]]

Uniquess is an issue, though. Journal entries might just be named after day in month (e.g. 12.md in /2021/08), which means a lot of 12.md in the workspace.

Alternative solution

A code action is provided (as Refactor), which detects the QuickLink-Syntax and converts it to a proper link.

  1. User enters: a file link to [[workshop notes]]
  2. Code Action triggered: Create note and transform to link
  3. [[workshop notes]] is transformed to [workshop-notes](../notes/202108-workshop-notes.md). The file name follows the pattern in the configuration
  4. A new file is created with the title # Workshop Notes

Open Questions:

How to deal with scopes?
[[workshop notes]] : The new file is created in default path for notes
[[workshop notes #projA]] : The new file is created in scope path for notes

The text within the brackets [[]] is resolved like the text in the magic input. The following should be possible

  • [[+1]] links to the entry of next day
  • [[08-22]] links to the entry of of the August 22nd of current year
  • [[yesterday]] links to the entry of previous day
  • [[tom]] links to the entry of next day
  • [[some text]] links to a note titled "some text"
  • [[some text #projA]] links to a note titled "some text" in scope ProjA