nldates-obsidian icon indicating copy to clipboard operation
nldates-obsidian copied to clipboard

"Parse as link" doesn't respect wikilink settings.

Open iamrecursion opened this issue 3 years ago • 1 comments

When inserting a link from parsed text via the "Parse natural language date (as link)" command, it fails to respect the user's settings as to whether wiki links or markdown links should be used (like standard linking does). It looks like getParseCommand should use the logic from generateMarkdownLink, but doesn't.

iamrecursion avatar Nov 17 '21 20:11 iamrecursion

For anyone else experiencing this, I fixed it locally in my own vault; it's a one-line change as the issue description suggests (thanks!).

I would make a PR, but I am not a plugin developer myself and am not sure if there's additional context I'm missing (with the aliases, with any other user settings we need to respect, etc.), or contribution guidelines to follow. The same line should still work in the TypeScript source version, though.

// <vault path>/.obsidian/plugins/nldates-obsidian/main.js
// getParseCommand, new contents for second half starting at the declaration of newStr

var newStr = "[[" + date.formattedString + "]]";
if (mode == "link") {
	// new version
	newStr = generateMarkdownLink(plugin.app, date.formattedString, selectedText);

	// original version
	// newStr = "[" + selectedText + "](" + date.formattedString + ")";
}

// ... everything after remains the same
// else if (mode == "clean") {


tuchandra avatar May 25 '22 02:05 tuchandra