--- a/node_modules/matrix-react-sdk/src/SlashCommands.tsx +++ b/node_modules/matrix-react-sdk/src/SlashCommands.tsx @@ -68,6 +68,29 @@ export const Commands = [ new Command({ + command: "greentext", + args: "", + description: _td("4chan-like greentext arrows"), + runFn: function(cli, roomId, threadId, args) { + const texts = args.split(/\n{2,}(.+|\n+)/g); + const greentext = texts[0]; + const normalText = texts[1] || ""; + + let plainGreentext = greentext.replace(/^/g, ">"); + plainGreentext = plainGreentext.replace(/(?:\r\n|\r|\n)+/g, "\n>"); + + let htmlGreentext = greentext.replace(/^/g, ">"); + htmlGreentext = htmlGreentext.replace(/(?:\r\n|\r|\n)+/g, "
>"); + + return success(ContentHelpers.makeHtmlMessage( + plainGreentext + "\n" + normalText, + `${htmlGreentext}
${normalText}`, + )); + }, + category: CommandCategories.messages, + }), + + new Command({ command: "spoiler", args: "", description: _td("slash_command|spoiler"),