handle more complex ruby from/to html - fixes #605

this is not exactly great, but it should be "good enough"

note that the new `group` function should not escape in the wild, as
we don't document it and only use it internally

I tried using `$[scale foo bar]` instead of `$[group foo bar]`, but
that would be rendered as `<i>foo bar</i>` when sent over the network
to non-misskey instances, and we don't want that
This commit is contained in:
dakkar 2025-01-18 12:51:38 +00:00
parent 42d8279610
commit 01a5300be8
3 changed files with 84 additions and 0 deletions

View file

@ -358,6 +358,10 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
return h('ruby', {}, [...genEl(token.children.slice(0, token.children.length - 1), scale), h('rt', text.trim())]);
}
}
case 'group': { // this is mostly a hack for the insides of `ruby`
style = '';
break;
}
case 'unixtime': {
const child = token.children[0];
const unixtime = parseInt(child.type === 'text' ? child.props.text : '');