willasm / obsidian-md-vsc

MIT License
23 stars 1 forks source link

Important Information for v1.2.0 Update

The backlinks data file used by the extension has changed what information it saves to its data file. It now also stores the backlink description text. This was required to allow the extension to update the descripion text in Obsidian after it has been edited in VSCode. On first launch of v1.2.0 the extensions data file will automatically be updated to include existing backlinks description text from the VSCode file (Note: A backup of the file is created before the update). The downside of this process is that it has to retrieve all the text up to the begining of the line, that is the only way possible as there is no way for the extension to know what else is on that line. That is the reason for making this change in the first place, so the extension will be able to know where the backlink begins. It will insert 2 more backlink separators, one at the end and one at the begining. This will mean you will need to edit the backlink text slightly. Here are some examples...

Before update...

  let fileJsonObject = [];   // TODO: Your description text | File: Obsidian Filename | ID: 1701935244

After update... This would cause an error in your code.

|  let fileJsonObject = [];   // TODO: Your description text | File: Obsidian Filename | ID: 1701935244 |

To correct this simply move the first seperator to the begining of the backlinks description text, like this.

  let fileJsonObject = [];   // | TODO: Your description text | File: Obsidian Filename | ID: 1701935244 |

I apologise for any inconvenience this may cause anyone. Since it is a very new extension with not a lot of downloads yet I'm hoping the impact will be minimal. This change was absolutely necessary to include any new features in the future. If this causes any major issues for you please do contact me, it does create a backup of the data file in the extensions global storage folder first so all backlinks can be restored if necessary. If you need to you can always just re-create your backlinks and then delete the old ones.

Obsidian MD for VSCode

Connect to Obsidian directly from within Visual Studio Code.

Obsidian is a powerful and extensible knowledge base that works on top of your local folder of plain text files. You can get more information and download it from here

Features

Requirments

Not required but recommended

Settings.json

Note: The Default Vault, Default Note and Default Vault Path settings are created automatically when running the commands...

Obsidian MD: Set Default Vault and Note (Global)

and for workspace settings...

Obsidian MD: Set Default Vault and Note (Workspace)

Commands

The following commands are available from the command pallette: (Windows: CTRL+Shift+P or F1) (Mac: CMD+Shift+P)

Obsidian MD: Connect with Obsidian (Default Hotkey - ALT+O)

This is the command to open the menu system to communicate with Obsidian. See the The command Structure Outline for details. If this is the first time it is run, and the default vault and default note are not defined in the settings, the command Obsidian MD: Set Default Vault and Note (Global) will be run prompting you for the default vault and default note. These are required by the extension to operate so please set them when prompted.

Obsidian MD: Set Default Vault and Note (Global)

Sets your default vault and the default note within that vault in your global settings.json file.

Obsidian MD: Set Default Vault and Note (Workspace)

Sets your default vault and the default note within that vault in your workspace settings.json file. This will override your global settings allowing you to define a specific vault and default note on a per project basis.

Backlinks

Backlinks are links created in your default note or daily note in Obsidian that link back to a specific line within any file in your Visual Studio Code project. When inserting a backlink you will first be prompted for a decription prefix (These can be edited in the extensions settings). You can press Esc for no prefix if you wish. Next you will be prompted for a text desription which will be used as the text for the backlink (This is required). The backlinks should be placed inside a comment so as to not cause code errors.

Example of Backlinks Text Inserted Into Obsidian Default/Daily Note Files

Link:

[NOTE: Some Description | File: Example.txt | ID: 1701328121](vscode://file/c:/programming/code/my_code/vscode/test-folder/Example.txt:1)

Button:

name NOTE: Some Description | File: Example.txt | ID: 1701325515
type link
action vscode://file/c:/programming/code/my_code/vscode/test-folder/Example.txt:1

Button with Class Defined:

name NOTE: Some Description | File: Example.txt | ID: 1701325515
type link
class buttonclassname
action vscode://file/c:/programming/code/my_code/vscode/test-folder/Example.txt:1

In the examples you are free to edit the prefix (NOTE:) and the description (Some Description).

Do Not edit the File: Example.txt portion. That will be updated automatically if the file is renamed.

Do Not edit the ID: 1701328121 portion. This is a unique Identifier used by the extension to maintain the Backlink.

Do Not edit the File: vscode://file... portion. This is the actual link to the Visual Studio Code files line for the Backlink. This is maintained by the extension.

Examples of Backlinks Text Inserted Into Visual Studio Code Files

Note: Link and Buttons Text Format is Identical:

NOTE: Some Description | File: obsidian-md-vsc | ID: 1701328992 (Default Note)

NOTE: Some Description | File: 2023-11-30 | ID: 1701330039 (Daily Note)

Example Backlinks Screenshot from Obsidian

Backlink Examples from Obsidian...

Backlink Examples

Status Bar Button Screenshots

Without Default Vault and Note set... (will run the command Obsidian MD: Set Default Vault and Note (Global))

Status Bar Button No Vault Set

With Default Vault and Note set... (will run the command Obsidian MD: Connect with Obsidian (Default Hotkey - ALT+O))

Status Bar Button With Vault Set

Command Menu Screenshots

Command Menu Home... To activate, run the command Obsidian MD: Connect with Obsidian (Default Hotkey - ALT+O)

Command Menu Home

Open in Obsidian Submenu...

Open in Obsidian Submenu

Daily Note Submenu...

Daily Note Submenu

Daily Note Prepend/Append to Header Submenu...

Daily Note Prepend/Append Submenu

The Command Structure Outline

Note: Some menu commands will only appear under specific conditions, for example...

All the Insert selected text... items will not be shown when no text is selected

Release Notes

See the Release Notes for details.