#Modify html before sending to browser
1 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
Maybe you can use middleware, and use response.transformData?
wait I don't think thats available
I think you can wrap everything in a server component, by converting the children prop
What you can do is wrap something like
<SuperscriptRegistered>
We love BrandX® and BrandY®. The BrandZ® series is coming soon.
</SuperscriptRegistered>
and SuperscriptRegistered
import React from 'react';
type Props = {
children: string;
};
export default function SuperscriptRegistered({ children }: Props) {
// Replace all occurrences of ® with superscript
const replaced = children.replace(/®/g, '<sup>®</sup>');
return (
<span dangerouslySetInnerHTML={{ __html: replaced }} />
);
}
You can wrap it around every text.
Or you can use a similar approach to wrap everything, but I'm not sure if it'll work, as it'll be too complex