There’s no need to do any string manipulation, you can use regex to match the part of the body that comes after “:” and style that differently:
#show heading.where(level: 5): it => {
set text(weight: 600)
show ":": set text(weight: 600) // undo matching of ":" in show rule
show regex(":.*"): set text(weight: 300)
it
}
(possibly the show rule matching only “:” could be combined into the regex one, but I am bad with regex…)
You can hover over variables to show what their methods are, this is useful for debugging (see: Tips on debugging Typst code, including the dark magic). Alternatively you can use the repr function.
For headings in particular, all of their methods are also outlined in the docs: Heading - Typst Documentation
heading(
level: auto|int,
depth: int,
offset: int,
numbering: none|str|function,
supplement: none|auto|content|function,
outlined: bool,
bookmarked: auto|bool,
hanging-indent: auto|length,
content // body
) → content
I don’t know exactly how cmarker works, but if it’s possible i’d pass this data to a custom solution function, instead of doing semi-hacky things with headings
It works here, but for more complex tasks doing it this way is easier, and doesn’t lead to weird artefacts (e.g. you might not want that solutions are headings)