How to select text without Backticks, in dynamic mode?

Any suggestions? Ideas? Plugins?
Obsidian_hUW05d2MnW

Click once within the text, and then select the text without the backticks.

If on the other hand, the backtick sentence is part of a larger sentence, I don’t know how to select this complete sentence without the backticks. That is, you could go to reading view, and then select the text, and paste it as plain text afterwards. But I’m not sure if you can, or how to do it, in live-preview without the backticks.

1 Like

The following works on a Mac:

select text

2 Likes

do you have the templater plugin? you could create a script that would clean it and assign it to a shortcut, like ctrl+shift+c.

Something like this will do what you need:

<%*
const editor = app.workspace.activeLeaf.view.editor;
const selection = editor.getSelection();
let text = selection ? selection : editor.getLine(editor.getCursor().line);
text = text.replace(/^\s*`(.*)`\s*$/g, '$1');

const blob = new Blob([text.trim()], {
	type: ["text/plain", "text/html"]
});
const data = [new ClipboardItem({
	["text/plain"]: blob,
	["text/html"]: blob
})];
navigator.clipboard.write(data);
if(selection) {
	tR = selection;
}
%>

A variation of this could be to double-click on the first word, and then drag to the end as it keeps extending the selection. However, these are also just variations where one select the blocks to allow Obsidian to leave live-preview (or dynamic as the OP called it), and select from the true source variant.

2 Likes