How to debug Javascript snippet in Obsidian?

I saw BenCodeZen debugging some snippet of Javascript code he wrote in a dataviewjs section. Doing this he opened the “developer tools”. But I don’t understand how to manage this in Obsidian under Windows. I can’t find any feature in the settings doing this. Can you help me?

1 Like

The Developer Tools can be opened on windows with the shortcut:
Ctrl + Shift + I

2 Likes

Thank you. Next time I will ask earlier :smile:

Some more context for others finding this: Obsidian is made using Electron, basically the Chrome browser. And because it’s a browser we can use Chrome’s Developer tools to debug Obsidian.

More information about the Chrome Dev Tools: Chrome DevTools - Chrome Developers

Hi,

I am very interested in learning how to debug JavaScript snippets of DataviewJS or Templater, but I am not sure how to get started. While I have some beginner knowledge of JavaScript, I have no experience with the console.

Here are my questions:

  • Do you have any tips on how to get started?
  • When I look at the Obsidian console, I see error messages like this: image
    but I don’t understand them.
  • Is it possible to set breakpoints in a Templater or DataviewJS snippet? With this, I could at least identify the location where the code has an error.

Thank you in advance,
Silias

1 Like

This seems useful: How to debug Obsidian plugins – mnaoumov.NET

2 Likes