I found someone's custom macro: https://gist.github.com/ChapelR/803ec192cf5922f498652bd6a20a4bf8.
You can specify a block of text and replace certain words or letters in that block, which is much like Harlowe's replace except it doesn't apply to the whole passage, which is fine for my purposes.
function match (id, target, contents, macroName) {
return $(document.createElement('span'))
.attr({'id' : id, 'data-term' : target })
.addClass('macro-' + macroName)
.wiki(contents);
}
function change (id, replacement) {
var $el = $(id),
text = $el.text(),
target = $el.attr('data-term'),
$content;
target = new RegExp(target, 'g');
text = text.replace(target, replacement);
$content = $el.empty().wiki(text);
}
Macro.add('match', {
tags : null,
handler : function () {
if (this.args.length < 2 || this.args.length > 2) {
return this.error('incorrect number of arguments');
}
var id = Util.slugify(this.args[0]),
target = this.args[1], $content;
$content = match(id, target, this.payload[0].contents, this.name);
$content.appendTo(this.output);
}
});
Macro.add('change', {
handler : function () {
if (this.args.length < 2 || this.args.length > 2) {
return this.error('incorrect number of arguments');
}
var id = Util.slugify(this.args[0]),
replacement = this.args[1];
change('#' + id, replacement);
}
});