Plugin for highlight line in code?

Hello

It is an available plugin for highlighting selected lines in code,
for example from tailwind documentation:

I too would like a line highlighter, this could be an easy plugin if I’m not mistakened. Wonder if it already exists?

You can do this with an CSS snippet:

/*for legacy editor*/
.CodeMirror-activeline.CodeMirror-linebackground{
  background-color: #468eeb33;
}


/*for live preview mode*/
.cm-active.cm-line{
  background-color: #468eeb33;
}

I using better code block plug-in, but is not working.
I have version 0.15.9 (installer 0.14.15) on my macbook m1 max, this is setup:

And markdown code effects:

What is wrong?

ok, its working, but only in reading view, it is possible working also in editing mode? https://i.imgur.com/HsQpeqH.png

You mean, something like this? :slight_smile:

I’m working on it.

Thanks, it works.

I did some improvement.

/*for legacy editor*/
.CodeMirror-activeline.CodeMirror-linebackground{
  background-color: #468eeb33;
}

/*for live preview mode*/
.cm-active.cm-line{
  background-color: #468eeb33;
}

/*for live preview mode code block*/
div.cm-active.HyperMD-codeblock.HyperMD-codeblock-bg.cm-line{
  background-color: #468eeb33;
}
1 Like

This is available in mugiwaras plugin Codeblock Customizer as well as my plugin Code Styler!

What does “legacy editor” means tho? Source mode?

Nope, this is the old source mode editor before WYSIWYG editing. The current source mode does not use the legacy editor, only if you specify to use the legacy editor in settings. If you don’t use this setting, then it doesn’t really matter.

1 Like

As of Obsidian v1.5, the legacy editor was completely removed, so no option for that anymore.

https://obsidian.md/changelog/2023-12-26-desktop-v1.5.3/

1 Like