skyra-project / discord-components

Discord Webcomponents for real looking messages on the web
https://discord-components.js.org
MIT License
250 stars 40 forks source link

request: Allow passing ReactNode as Embed Title or parse markdown in title #327

Closed diamkil closed 1 year ago

diamkil commented 1 year ago

Is your feature request related to a problem? Please describe. I'm trying to create a channel archive using these components and my embed titles are bolded. The component only allows a string as the embed title so it shows the two stars instead of being bolded

Describe the solution you'd like either parse the markdown in the title or allow us to pass a ReactNode as the title so we can bold it ourselves

Describe alternatives you've considered None, typescript gives me an error if I try to pass a component

Additional context image

Edit: also applied to Embed Field Titles image

favna commented 1 year ago

First of all, the react bindings are automatically generated so we cannot allow it to process a ReactNode as the core functionality has no knowledge of what React or ReactNode is. You could say there is no React as far as the lib is actually concerned. It's all just pure HTML and CSS. See: https://github.com/skyra-project/discord-components/blob/main/packages/core/src/components/discord-embed/discord-embed.tsx

Secondly, as this library is supposed to only handle HTML and CSS, you are responsible yourself for parsing Markdown. You have to customize the styling if you want to make the title bold, i.e. customize the CSS .discord-embed .discord-embed-title (https://github.com/skyra-project/discord-components/blob/d1efd302629c95887889950ffcd49108200eddda/packages/core/src/components/discord-embed/discord-embed.css#L119-L129)

That said, titles are already bold, and even on Discord they can never not be bold. The top one is User Added and the bottom one is **User Added**.

diamkil commented 1 year ago

I actually didn't realize that bolding the title had no effect, I feel like an idiot now. Thanks for letting me know, I'll be updating my bot to not use bolded titles instead