Skip to content

Add support for Obsidian Callouts #632

@jcdiv47

Description

@jcdiv47

🚀 The feature, motivation and pitch

As @epwalsh suggested in the discussion, submitting a feature request here for greater visibility.

Motivation

I have been frequently using Obsidian callouts in my notes since I started using Obsidian. It serves as an important highlight tool in my workflow and I enjoy the look. If the plugin could present some kind of interaction when one is implementing a callout, it might provide an even smoother editing experience.

Feature

Add (at least a certain degree of) support for Obsidian callouts.

Here is a simple example of callout syntax:

> [!info] Callout can have a title
> Here's a callout block.
> It supports **Markdown**, [[Internal link|Wikilinks]], and [[Embed files|embeds]]!

Basically what I would like is similar experience as editing a callout in Obsidian. I am no expert but I imagine it would be a hassle and unnecessity to try to reproduce the exact effect of callouts in Neovim. It may very well be sufficient for a smooth editing experience imho if something like the following is achieved:

  1. When typing something like > [!info] the line turns into an icon, in similar fashion to say - [x] in checkboxes.

screenshot-20240607-171501

  1. When I hit enter/return to go to a new line inside a callout block, it would automatically add > to the beginning of this new line. I presume a simple solution/workaround is some custom comment format options like
vim.api.nvim_create_autocmd("FileType", {
	pattern = "markdown",
	callback = function()
		vim.opt_local.formatoptions:append("r") -- `<CR>` in insert mode
		vim.opt_local.formatoptions:append("o") -- `o` in normal mode
		vim.opt_local.comments = {
			"b:>", 
		}
	end,
})

(code snippet copied from reddit)

Alternatives

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions