Add css classes to a block

Use case or problem

I want more flexibility with how the elements of my notes get displayed in preview mode. For example, two blocks that appear side-by-side instead of one after the other.

Proposed solution

Similar to block referencing, one could write ^.classname1.classname2 to add the classname1 and classname2 to the element’s classes.

Current workaround (optional)

I tried using html divs, but they make for ugly markdown. More importantly, internal links don’t work inside html (why is that by the way).

Related feature requests (optional)

If internal links could be made to work inside html, I could work with that (though it is a bit ugly).

12 Likes

Hi! I wrote a plugin for that: GitHub - ixth/obsidian-stylist: Obsidian plugin that allows to add classes and styles on markdown blocks

You can install it using BRAT

Unfortunately, it only works in Preview mode for now.