Skip to content

MrGVSV/obsidian-better-comment-toggle

Repository files navigation

Obsidian Better Comment Toggle

Improved comment toggling in Obsidian.

Features

  • Easily toggle comments line-by-line or over a selected range of lines
  • Configure the start and end tokens for toggled comments
  • Change the appearance of commented lines
  • Support for both code and math blocks (including custom languages)
  • Maintains indentation

Demos

Toggling lines one-by-oneToggling a selected range of linesUsing custom comment tokensUsing a custom comment appearanceToggling a comment inside a code blockToggling a comment inside a math block

Details

This plugin is purely WYSWIG. That is, there are no hidden HTML tags or other metadata embedded into your notes. The comments exist as you see them in the notes. Any additional styling (e.g. font color) is purely cosmetic and exists only in the editor.

The default comment style is set to HTML (<!-- -->), which is the syntax specified by CommonMark. However, you can configure this plugin to use Obsidian-style comments (%% %%), or even define your own!

Tips

It's recommended to replace the existing keybinding for Obsidian's comment toggling command with the one provided by this plugin:

  • +/ (Mac)
  • Ctrl+/ (Windows)

Support

This plugin is totally free to use! I have a lot of fun making stuff like this, so I never expect any type of financial compensation. But if you enjoy the plugin and are feeling generous, I certainly won't say no to a cup of coffee!