Backslash in wikilinks?

Just a minor issue. Linking to another draft s.a. [[Event 2026-03-18 16:30]] works perfectly fine.

However, when I try to link to [[Event 2026\-03\-18 16:30]] with backslashes (because I have not found a way to force CSS to render “-” hyphens in dates and not as en-dashes) Drafts creates the new draft – including backslashes – but can not find it when clicking the link and asks the question again (with my backticks to show the backslashes):

A draft matching the title “Event 2026\-03\-18 16:30” was not found. Would you like to create a new draft with that title?

Any suggestions?

Seems like a bug. I probably need to fix by properly escaping the backslashes in the query tokenizer.

Does seem like a weird requirement to name them this way…what are you outputting them as that requires this?

Thanks,

Yes, it is truly a weird syntax but the iso-date 2026-03-18 (with hyphens as standard) in Markdown is rendered as 2026–03–18 (with n-dashes) in Preview. I thought I could fix this by tweaking the CSS but found no other way to do it then escaping the hyphens.

If there is a better way to do it, I am eager to hear about it.

(In the meantime I put an s in the link s.a. [[s:Event 2026-03-18 16:30]] which is ok.)


P.S.

I may add that these titles are somewhat exceptional and come from a very handy workflow that generates a memo draft, on the fly, by double-tapping the command-key. E.g. today I had a meeting with the Committee for Welfare in the Nordic Region and was on a high alert so ⌘⌘ was just the perfect way to get a pre-filled template with the six fundamental questions: why, what, how, when, where and who, even with pre-defined markers like <|> for quick and easy navigation.

Now, I previously created a complete time tracking system within Drafts so I thought it was a good idea to link even such drafts, with titles like # Event 2026-03-18 14:00 to the log (where the date is prefilled but may be different from both the creation date and last modified date but may be important for other purposes). That’s when a problem occured I had not encountered before.

D.S.

Well, your en-dash problem is likely from the Markdown parser. Both MultiMarkdown and GitHub variants have “Smart Quotes” conversion - which also subs in en-dash and em-dashes. If you disable that in your Markdown preferences, those will not be converted.

Well, my humble apologies. Thank you, that works perfect!

Furthermore, I don’t need smart quotes, because various languages have different standards, so I type all characters manually. The problem with that, however, is line breaks as in this example:

<|⌃⌥↑↓ previous/next placeholder> What about line breaks when not using ”smart quotes”?

This renders in my preview window as:

<|⌃⌥↑↓ previous/next placeholder> What about line breaks when not using ”
smart quotes”?

That doesn’t seem to be affected by smart quotes, but a problem with the characters used to mark quotations. I haven’t checked if that is different in Marked2 or other programs, but can usually find a reasonable fix.

The original problem is now solved, however (as long as I don’t need backslash in any title) so I will update ALL of my titles with “escaped hyphens”.

MANY THANKS!
/P-D

FYI, found and fixed the issue with escaping \ in the query tokenizer for the next release, too, so the title query will work right.

1 Like

Just amazing how prompt, helpful and professional you are! Thanks a lot!

1 Like

New problem – solved

FWIW I got a new problem.

When it turned out unnecessary to escape the hyphens, s.a. 2026\-03\-19 I wondered how I could now easily search and replace all those occurences in about 75 drafts in the whole database. At first this seemed daunting, but was, in fact, quite simple due to Drafts scripting possibiliites, and AppleScript + action.

This may not be the best solution, and is not generalized to other regexs, but only took minutes to create, and served my purpose well:

AppleScript

tell application "Drafts"
	set myDrafts to drafts whose content contains "\\-"
	repeat with d in myDrafts
		perform action (action "Replace") on draft d
	end repeat
end tell

Action Replace (JavaScript)

draft.content = draft.content.replace(/\\-/g, "-");
draft.update();

I was almost shocked it finished – with no apparent errors – within seconds and did not bather myself to make it more general, commented and neater but disabled the action and kept it for future use, if needed.

Once again – as always with Drafts, as it seems – problem solved, mission accomplished – but any improvements are allways highly appreciated. (I guess e.g. you could use one JavaScript action step to accomplish this even more effciently… Yes, I could… :wink: