Steps for creating custom small-actions to use in plugin?

AI-generated summary

The discussion revolves around creating custom small actions in a Discourse plugin, similar to those shown in the example image. Hooksmith seeks guidance on implementing these actions with customizable icons and text. david recommends the discourse-assign plugin as a reference, pointing to specific code sections for backend and frontend implementation. Hooksmith then asks about rendering richer text in the small action, noting that they achieved the desired formatting by manually adding the cooked class to the small-action-desc div. They also mention adding custom SCSS to style the content, such as highlighting changes with ins and del tags.

I’m working on some domain-specific plugins for our forum and we would like to create custom small actions similar to these:

In particular I just need to be able to put notices like these on the topic but being able to customize the icon and the text.

Can anyone walk me through the constructs/modules/templates/etc I would need to hook into to accomplish this on the back-end and front-end, or could you point me to an existing plugin that currently implements this?

Thank you!

discourse-assign is probably the best example of this:

And then some stuff to add the icon / content

https://github.com/discourse/discourse-assign/blob/master/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6#L158-L169

Thanks, this helped out a lot.

What would be the best way to go about making the small action display richer text?

Current:
image

What I want: (I achieved this by manually inserting the cooked class into the div with class small-action-desc)

image

I skimmed through the source code about post transformers but could not find anything related to this


EDIT: ended up just adding this as .scss

.custom-message {
    ins {
        background-color: dark-light-choose(
            $success-low,
            scale-color($success, $lightness: -60%)
        );
    }
    del {
        background-color: dark-light-choose(
            $danger-low,
            scale-color($danger, $lightness: -60%)
        );
    }
}