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

Search results displayed in the middle of frontmatter

Open marconoris opened this issue 1 year ago • 2 comments

Hi,

there is an issue when plugin publish search results in note: it put results in the middle of frontmatter and not in cursor location...

marconoris avatar Nov 15 '23 12:11 marconoris

This #16 seems to be a duplicate of #17.

rcherny avatar May 05 '24 14:05 rcherny

Looking at the code, it seems like possibly it is inserted to actually replace the selection:

https://github.com/jmilldotdev/obsidian-wikipedia/blob/master/main.ts#L165

editor.replaceSelection(this.formatExtractInsert(extract, searchTerm));

From testing, this does seem to resolve the problem.

If you put in your heading, and then the place where you want the content to be injected, it replaces. Example:

# Obsidian 

content (select this text)

Result:

# Obsidian

> Obsidian is a personal knowledge base and note-taking software application that operates on Markdown files. It allows users to make internal links for notes and then to visualize the connections as a graph. It is designed to help users organize and structure their thoughts and knowledge in a flexible, non-linear way. The software is free for personal use, with commercial licenses available for pay.
>
> [Wikipedia](https://en.wikipedia.org/wiki/Obsidian%20(software))

rcherny avatar May 05 '24 15:05 rcherny