Classy Twine Hooks

Last time, I pined for a way to style a specific piece of text with a CSS class. Because if there are a lot of styles, putting them together in a semicolon list feels counter-productive. So I asked the forum about it.

Initially, I wanted a custom macro to enclose the specified text with s or something that can take the specified class name. However, the guys at the Twinery forum (let’s be honest, it’s one guy) found a way to emulate that using Named Hooks.

  |classy>[This text is classy] while this is not.

Then, in Story Stylesheets,

tw-hook[name="someClass"] {
	color: orange;
}

Works like a charm!

Leave a Reply