From 3d3bf60c8875e85a8a0c4ffa81ee00524c7e576a Mon Sep 17 00:00:00 2001 From: Aly Thobani Date: Sat, 17 May 2025 22:24:37 -0700 Subject: [PATCH] docs: update docstrings for jumpToLink regexes --- motions/jumpToLink.ts | 61 +++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/motions/jumpToLink.ts b/motions/jumpToLink.ts index ef44689..a95e06b 100644 --- a/motions/jumpToLink.ts +++ b/motions/jumpToLink.ts @@ -4,44 +4,43 @@ import { MotionFn } from "../utils/vimApi"; /** Regex for a wikilink. Starts off with a negative lookbehind for a backslash, to make sure the * opening square bracket isn't escaped. * - * We don't bother making the internals of the wikilink regex too complicated (using `.*?` to allow - * any characters), because Obsidian's markdown parser is imperfect and inconsistent anyway, so we - * may as well just match anything that generally looks like a wikilink. + * Note that although Obsidian doesn't allow most special characters inside a file name (e.g. `[`, + * `]`, `:`, `#`, `|`, `^`, `\`, or `/`), its Markdown parser is lenient enough to result in + * basically anything inside non-escaped double square brackets being rendered as a wikilink. This + * even includes a trailing backslash, which you'd think would escape the first closing square + * bracket! So we follow suit and allow any character inside the double square brackets, except for + * a newline (which `.` won't match as long as we don't use the `s` flag). */ const WIKILINK_REGEX = /(?