ported $[small ] and $[center ] from firefish #60

Open
leah wants to merge 4 commits from cherrypick/small-and-center into main
2 changed files with 17 additions and 1 deletions
Showing only changes of commit 4c8d44564c - Show all commits

View file

@ -294,6 +294,20 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
style = `background-color: #${color}; overflow-wrap: anywhere;`;
break;
}
case 'small': {
return h(
"small",
{
style: "opacity: 0.7;",
}, genEl(token.children));
}
case 'center': {
return h(
"div",
{
style: "text-align: center;",
}, genEl(token.children));
}
case 'border': {
let color = validColor(token.props.args.color);
color = color ? `#${color}` : 'var(--accent)';

View file

@ -122,7 +122,7 @@ export const DEFAULT_SERVER_ERROR_IMAGE_URL = 'https://xn--931a.moe/assets/error
export const DEFAULT_NOT_FOUND_IMAGE_URL = 'https://xn--931a.moe/assets/not-found.jpg';
export const DEFAULT_INFO_IMAGE_URL = 'https://xn--931a.moe/assets/info.jpg';
export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'scale', 'position', 'fg', 'bg', 'border', 'font', 'blur', 'rainbow', 'sparkle', 'rotate', 'ruby', 'unixtime', 'crop', 'fade'];
export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'scale', 'position', 'fg', 'bg', 'border', 'font', 'blur', 'rainbow', 'sparkle', 'rotate', 'ruby', 'unixtime', 'crop', 'fade', 'center', 'small'];
export const MFM_PARAMS: Record<typeof MFM_TAGS[number], string[]> = {
tada: ['speed=', 'delay='],
jelly: ['speed=', 'delay='],
@ -148,4 +148,6 @@ export const MFM_PARAMS: Record<typeof MFM_TAGS[number], string[]> = {
unixtime: [],
fade: ['speed=', 'delay=', 'loop=', 'out'],
crop: ['top=', 'bottom=', 'left=', 'right='],
center: [],
small: [],
};