Realize various functions: conversion, batch addition, text extraction, global modification, shortcut key operation, collection of MD documents(download:ObHelper.zip)

ObHelper.zip (385.4 KB)

Welcome to the OB Editing Assistant v1.7.

Note: the function of this tool is only valid in Obsidian software!

  1. In the Chinese input state, click the keys - [, [6, [9, 1 [[, 1 [9) to output half angle symbol combination;

  2. After selecting the text

2.1. Press the F2 key to add the []] symbol at both ends of the text; if the text contains [[]], remove it;

2.2. Press the CTRL + F2 key to quickly clear all the [[]] symbols in the current page;

  1. Press F3 key to search for the current keyword quickly (OB shortcut key is Ctrl + Shift + F);

  2. Press F4 key:

4.1. If single line text is selected, a new note with the name of stroke text will be created quickly;

4.2. If multi line text is selected, create a new note to save the selected text and complete the internal link;

  1. Press F5 / F6 / F7 / F8 to set or cancel bold, highlight, italics and delete effects;

  2. After entering the text, press the shortcut keys such as Ctrl + 1 / 2 / 3 / 4 / 5 / 6 to quickly switch the title level;

  3. Press the X, C, V keys while holding down the left mouse button, which is equivalent to cutting, copying and pasting operations;

  4. Pressing Ctrl + Shift + V can achieve enhanced paste

8.1 you can paste the copied web documents or excel tables with more than 1 column as the markdown syntax style;

8.2 you can paste the copied markdown grammar style table into excel;

  1. Right mouse button gesture

9.1. Stroke left to return to the previous note; right to continue with the next note;

9.2. Stroke up to copy the selected text; down to paste.


After v1.4, some practical functions have been enhanced

If multi line or spaced text is selected, the []] symbol can be added at both ends of each text segment;

Press F9 to set the sequence table; press F10 to set the unordered list;

Press Ctrl + Shift + C to save the selected page content as MD document;

Press F12 to specify the Library Directory for storing MD documents;

The mouse gesture function is cancelled to avoid interference with the normal operation of obsidian.

If you find bug or functional requirements, welcome to leave a message to silkworm (QQ: 312815311)

13 Likes

Wow, tested it a little and like it! Do you mind sharing the AutoHotkey code? If not, that’s okay of course too. Thanks for your work.

回头稳定后会分享的

For anyone who does not understand what @iteacher has just said, he basically said "I will share it (the AutoHotkey Code) when it is stable. " Luckily I know Chinese.

;当按下F2键后,先复制选文,判断,如包含[[]]符号,则正则替换为空;反之则正则替换为前后补加[[]]
F2::
if WinActive(“ahk_exe obsidian.exe”)
ClipSaved := ClipboardAll
Send, ^c
Sleep, 100
if (clipboard != “”)
{
FoundPos := RegExMatch(clipboard, "[[.
]]")
if (FoundPos > 0)
{
clipboard := RegExReplace(clipboard, “[[|]]”, “”)
Send, ^v
}
else
{
clipboard := “[[” clipboard “]]”
Send, ^v
}
}
else
{
Send {F2}
}
Sleep, 50
Clipboard := ClipSaved
ClipSaved := “”
Return

1 Like

;按CTRL + F2键可快速清除当前页面中的所有[[]]符号
^f2::
if WinActive(“ahk_exe obsidian.exe”)
ClipSaved := ClipboardAll
Send, ^a
Sleep, 200
Send, ^c
Sleep, 100
if (clipboard != “”)
{
FoundPos := RegExMatch(clipboard, "[[.
]]")
if (FoundPos > 0)
{
clipboard := RegExReplace(clipboard, “[[|]]”, “”)
Send, ^v
}
}
else
{
Send ,^{F2}
}
Sleep, 50
Clipboard := ClipSaved
ClipSaved := “”
Return

For anyone who has trouble understanding Chinese, I have provided translations of @iteacher’s comments:

After pressing F2, if the selected text is a link, it will be unlinked. Otherwise, the selected text will be linked.

F2::
if WinActive(“ahk_exe obsidian.exe”)
ClipSaved := ClipboardAll
Send, ^c
Sleep, 100
if (clipboard != “”)
{
FoundPos := RegExMatch(clipboard, "[[.</em> ]]")
if (FoundPos > 0)
{
clipboard := RegExReplace(clipboard, “[[|]]”, “”)
Send, ^v
}
else
{
clipboard := “[[” clipboard “]]”
Send, ^v
}
}
else
{
Send {F2}
}
Sleep, 50
Clipboard := ClipSaved
ClipSaved := “”
Return

Pressing Ctrl-F2 will unlink all the text in the current note.

^ f2::
if WinActive(“ahk_exe obsidian.exe”)
ClipSaved := ClipboardAll
Send, ^a
Sleep, 200
Send, ^c
Sleep, 100
if (clipboard != “”)
{
FoundPos := RegExMatch(clipboard, “[[. ]]”)
if (FoundPos > 0)
{
clipboard := RegExReplace(clipboard, “[[|]]”, “”)
Send, ^v
}
}
else
{
Send ,^{F2}
}
Sleep, 50
Clipboard := ClipSaved
ClipSaved := “”
Return
1 Like

Thanks @iteacher and @Mayonnaise2124 for the first 2 parts! I’m not very good with AutoHotkey, but this code will be a help.

1 Like

更新F2热键对应的代码:

F2::
if WinActive(“ahk_exe obsidian.exe”)
ClipSaved := ClipboardAll
Send, ^c
Sleep, 100
if (clipboard != “”)
{
FoundPos := RegExMatch(clipboard, "[[.
]]")
if (FoundPos > 0)
{
clipboard := RegExReplace(clipboard, “[[|]]”, “”)
Send, ^v
}
else
{
;clipboard := “[[” clipboard “]]”
clipboard := RegExReplace(clipboard, “m)\s$”, “”)
clipboard := RegExReplace(clipboard, “m)^”, “[[”)
;clipboard := RegExReplace(clipboard, " ", “]] [[”)
clipboard := RegExReplace(clipboard, “、”, “]]、[[”)
clipboard := RegExReplace(clipboard, “m)$”, “]]”)
Send, ^v
}
}
else
{
Send {F2}
}
Sleep, 50
Clipboard := ClipSaved
ClipSaved := “”
Return

分享F3热键对应的代码:

; 按下F3键,复制所选文字,激活搜索面板并进行搜索
*F3::
if WinActive(“ahk_exe obsidian.exe”)
ClipSaved := ClipboardAll
Send, ^c
Sleep, 100
if (clipboard != “”)
{
Send ^+f
Sleep, 100
Send, ^v
Sleep, 100
Send {Enter}
}
else
{
Send {F3}
}
Sleep, 50
Clipboard := ClipSaved
ClipSaved := “”
Return

This is very interesting, but a bit dated. Does it still work as of July 2021? Is there now a git or other location where this or something similar is looked after and updated to reflect any changes in obsidian versions? Thank you!

现在维护【ZH增强编辑】插件,可以实现上述大部分功能。可惜未能分享到Git

And what does that mean in English

频繁更新或补充新功能。

Now maintain the [zh enhanced editing] plug-in to realize most of the above functions. Unfortunately, I couldn’t share it with GitHub

ZH增强编辑0.3.7.zip (31.1 KB)