This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 143
Issue 250 - Support for rendering links inside dcc.Markdown
as dcc.Link
#711
Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
39c5524
support dcc.link in markdown
31ff730
changelog
ff282f3
rename to dccLink
a2df8b1
- add support for nested dccMarkdown
814227e
black
c85a9a0
eager loading
19cffd3
- escape html if dangerously_allow_html==False
b2fc924
update changelog
eeffbbb
- remove jsx wrapper
9db2a08
update snapshot name
8924637
correctly assign assets folder
4fefe13
move assets
ce2cba3
Update CHANGELOG.md
Marc-Andre-Rivet 6fb5a0a
Merge branch 'dev' into 250-markdown-link
Marc-Andre-Rivet 8c3a57c
Merge branch 'dev' into 250-markdown-link
Marc-Andre-Rivet e79f453
Merge branch 'dev' into 250-markdown-link
Marc-Andre-Rivet 4c41f86
Merge branch 'dev' into 250-markdown-link
Marc-Andre-Rivet 4e3c613
Merge branch 'dev' into 250-markdown-link
Marc-Andre-Rivet 1d771a2
transpile react-jsx-parser / override provided babel options
d9e7654
slight test improvement - make sure there is a code block
b731fe1
update build to chunk out resources shared by async and initial chunks
05778a4
lint
b487931
update manifest
959a11c
fix regression
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import React, {Component} from 'react'; | ||
import {type} from 'ramda'; | ||
import JsxParser from 'react-jsx-parser'; | ||
import Markdown from 'react-markdown'; | ||
|
||
import {propTypes, defaultProps} from '../components/Markdown.react'; | ||
import '../components/css/highlight.css'; | ||
|
||
import DccLink from './../components/Link.react'; | ||
|
||
export default class DashMarkdown extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
@@ -85,6 +88,10 @@ export default class DashMarkdown extends Component { | |
const displayText = | ||
dedent && textProp ? this.dedent(textProp) : textProp; | ||
|
||
const componentTransforms = { | ||
DccLink: props => <DccLink {...props} />, | ||
}; | ||
|
||
return ( | ||
<div | ||
id={id} | ||
|
@@ -110,6 +117,14 @@ export default class DashMarkdown extends Component { | |
<Markdown | ||
source={displayText} | ||
escapeHtml={!dangerously_allow_html} | ||
renderers={{ | ||
html: props => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we toss in a danderous HTML / XSS test for future sanity? |
||
<JsxParser | ||
jsx={props.value} | ||
components={componentTransforms} | ||
/> | ||
), | ||
}} | ||
/> | ||
</div> | ||
); | ||
|
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 |
---|---|---|
|
@@ -58,7 +58,7 @@ module.exports = (env, argv) => { | |
rules: [ | ||
{ | ||
test: /\.jsx?$/, | ||
exclude: /node_modules/, | ||
exclude: /node_modules\/(?!react-jsx-parser\/)/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sadly not transpiled to ES5 so needs to be re-transpiled. |
||
use: { | ||
loader: 'babel-loader', | ||
}, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we define the list of components we want to support are their name in markdown + props customization as needed.