Use a lookup function to determine the markup template in addition to the keywords. For example, the “markup template” lookup table for a chapter title looks something like this:
The markers, %n, %t, and %s (not shown) are replaced by the lable, title, and subtitle of the component, respectively.