-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#208): display description as markdown
Also refactor all other markdown descriptions to use this new component.
- Loading branch information
1 parent
4ba44cc
commit 47cf3c0
Showing
4 changed files
with
35 additions
and
50 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,27 @@ | ||
import remarkGfm from 'remark-gfm' | ||
import Markdown from 'react-markdown' | ||
import { externalLinkClick } from 'renderer/utils' | ||
const { App } = window | ||
|
||
export function MarkdownDescription(props) { | ||
return ( | ||
<Markdown | ||
remarkPlugins={[remarkGfm]} | ||
components={{ | ||
// override the rendering of link elements with a link element that opens in an external browser | ||
a: (props) => { | ||
return ( | ||
<a | ||
href={props.href} | ||
onClick={(e) => externalLinkClick(e, App)} | ||
> | ||
{props.children} | ||
</a> | ||
) | ||
}, | ||
}} | ||
> | ||
{props.children} | ||
</Markdown> | ||
) | ||
} |
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