@@ -6,6 +6,8 @@ import Tags from '../misc/tags';
6
6
import Moment from '../misc/moment' ;
7
7
import ReactMarkdown from 'react-markdown' ;
8
8
import { Link } from 'react-router-dom' ;
9
+ import { ensureUrl } from '../../constants/utils' ;
10
+ import linkRenderer from '../misc/linkRenderer' ;
9
11
10
12
class SingleChallenge extends Component {
11
13
static propTypes = {
@@ -67,7 +69,7 @@ class SingleChallenge extends Component {
67
69
< div className = "grey-box" >
68
70
< h2 > Description</ h2 >
69
71
< div className = "description" >
70
- < ReactMarkdown source = { challenge . body . description } />
72
+ < ReactMarkdown source = { challenge . body . description } renderers = { { link : linkRenderer } } />
71
73
</ div >
72
74
< a className = "anchor" id = "attachments" />
73
75
< h2 > Attachments</ h2 >
@@ -76,13 +78,14 @@ class SingleChallenge extends Component {
76
78
{ challenge . body . attachments . map ( ( a , key ) => (
77
79
< li key = { key } >
78
80
< i className = "icon-install" />
79
- < a href = "{{ url}}" title = "{{ name}}" target = "_blank" >
80
- { { name} }
81
+ < a href = { ensureUrl ( a . url ) } title = { a . name } target = "_blank" >
82
+ { a . name }
81
83
</ a >
82
84
</ li >
83
85
) ) }
84
86
{ ( ! challenge . body . attachments || challenge . body . attachments . length < 1 ) &&
85
- < li > This challenge does not have any attachments.</ li > }
87
+ < li > This challenge does not have any attachments.</ li >
88
+ }
86
89
</ ul >
87
90
</ div >
88
91
</ div >
@@ -95,7 +98,7 @@ class SingleChallenge extends Component {
95
98
< div className = "extra-points" >
96
99
< a className = "anchor" id = "extra-points" />
97
100
{ challenge . body . extra_points &&
98
- < ReactMarkdown source = { challenge . body . extra_points } />
101
+ < ReactMarkdown source = { challenge . body . extra_points } renderers = { { link : linkRenderer } } />
99
102
}
100
103
{ ! challenge . body . extra_points &&
101
104
< p > The requirements are complete as is.</ p >
@@ -104,7 +107,7 @@ class SingleChallenge extends Component {
104
107
< a className = "anchor" id = "technical" />
105
108
< h2 > Technical Notes</ h2 >
106
109
< div className = "technical-notes" >
107
- < ReactMarkdown source = { challenge . technical_notes } />
110
+ < ReactMarkdown source = { challenge . technical_notes } renderers = { { link : linkRenderer } } />
108
111
< p > When you're done, push to your repo and submit your answer.</ p >
109
112
</ div >
110
113
< a className = "anchor" id = "source" />
@@ -113,31 +116,31 @@ class SingleChallenge extends Component {
113
116
{ challenge . source . map ( ( s , key ) => (
114
117
< p key = { key } >
115
118
< strong > { s . name } : </ strong >
116
- < a href = { s . url } > { s . url } </ a >
119
+ < a href = { ensureUrl ( s . url ) } title = { ` ${ challenge . title } - ${ s . name } ` } target = "_blank" > { s . url } </ a >
117
120
</ p >
118
121
) ) }
119
122
</ div >
120
123
< a className = "anchor" id = "procedure" />
121
124
< h2 > Procedure:</ h2 >
122
125
< div className = "procedure" >
123
- < ReactMarkdown source = { challenge . procedure } />
126
+ < ReactMarkdown source = { challenge . procedure } renderers = { { link : linkRenderer } } />
124
127
< p > Look at our < Link to = "/learning" > help</ Link > section for more information about this.</ p >
125
128
</ div >
126
129
< a className = "anchor" id = "coding" />
127
130
< h2 > Coding</ h2 >
128
131
< div className = "coding" >
129
- { challenge . coding && < ReactMarkdown source = { challenge . coding } /> }
132
+ { challenge . coding && < ReactMarkdown source = { challenge . coding } renderers = { { link : linkRenderer } } /> }
130
133
{ ! challenge . coding &&
131
134
< div >
132
135
< p > To create your answer follow this steps:</ p >
133
136
< ol >
134
- < li > < a href = "https://help.github.com/articles/fork-a-repo/" > Fork</ a >
137
+ < li > < a href = "https://help.github.com/articles/fork-a-repo/" target = "_blank" > Fork</ a >
135
138
the repo to your account, or download the zip file</ li >
136
139
< li > Solve the ticket</ li >
137
140
< li > Commit your code</ li >
138
141
< li > Push your changes</ li >
139
- < li > Publish your version in < a href = "https://pages.github.com/" > Github Pages</ a > or
140
- < a href = "https://firebase.google.com/docs/hosting/" > Firebase Hosting</ a > </ li >
142
+ < li > Publish your version in < a href = "https://pages.github.com/" target = "_blank" > Github Pages</ a > or
143
+ < a href = "https://firebase.google.com/docs/hosting/" target = "_blank" > Firebase Hosting</ a > </ li >
141
144
< li > Submit your response</ li >
142
145
</ ol >
143
146
</ div >
0 commit comments