nothingislost / obsidian-dynamic-highlights

An experimental Obsidian plugin that highlights all occurrences of the word under the cursor
MIT License
132 stars 7 forks source link

FR: Highlight entire line / bullet based on keyword #34

Open ysakols opened 2 years ago

ysakols commented 2 years ago

Love this plugin! It would be very cool to be able to dynamically highlight a line based on a keyword, tag, (or emoji).

Example. In my notes, I might add the tag #actionitem or (question). I would love if that entire line of text, rather than just the word, was highlighted to make it easier to find!

thanks!

nothingislost commented 2 years ago

You can already do this. See my description of the various options here: https://github.com/nothingislost/obsidian-dynamic-highlights/issues/31#issuecomment-1039480068

What you're looking for is the "parent line" toggle. If you turn that on, then the div.cm-line element will receive a class matching your highlighter name.

For your example, you can import this:

{
  "ActionItem": {
    "class": "ActionItem",
    "color": "",
    "regex": false,
    "query": "#actionitem",
    "mark": [
      "line"
    ],
    "css": "div.cm-line.ActionItem {\n  background-color: pink;\n}"
  }
}
ysakols commented 2 years ago

thanks! I'll give it a go