forked from discordjs/discord.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ClientOptions): resolve unparsed markdown in documentation
Corrected the markdown rendering for `ClientOptions` to properly parse bold text and links. This fixes the issue where markdown elements were not displaying as intended. Closes discordjs#10558
- Loading branch information
1 parent
9ae3aae
commit d7ed351
Showing
4 changed files
with
160 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable react/no-unstable-nested-components */ | ||
import React from 'react'; | ||
import ReactMarkdown from 'react-markdown'; | ||
import rehypeRaw from 'rehype-raw'; | ||
|
||
interface ParsedTextProps { | ||
readonly text: string; | ||
} | ||
|
||
export const ParsedText: React.FC<ParsedTextProps> = ({ text }) => { | ||
return ( | ||
<ReactMarkdown | ||
rehypePlugins={[rehypeRaw]} // Parses raw HTML in markdown | ||
components={{ | ||
strong: ({ children }) => <strong>{children}</strong>, // Renders bold text | ||
a: ({ children, href }) => ( | ||
<a href={href} rel="noopener noreferrer"> | ||
{children} | ||
</a> | ||
), // Renders links | ||
}} | ||
> | ||
{text} | ||
</ReactMarkdown> | ||
); | ||
}; |
Oops, something went wrong.