Skip to content

Commit 37c2a9b

Browse files
authored
fix markdown links and Mustache Tag Replacement (#2780)
* fix markdown links and Mustache Tag Replacement * run formatting * rerun jobs * Update dependencies and fix URL transformation in UsePropertyReplacement hook - Downgraded `remark-gfm` from version 4.0.1 to 3.0.1 in both `package.json` and `package-lock.json`. - Updated `@types/mdast` from version 4.0.4 to 3.0.15 and adjusted related dependencies. - Modified the URL transformation logic in `UsePropertyReplacement.js` to change the behavior of `replacePropertyTags` from false to true.
1 parent ba0158f commit 37c2a9b

8 files changed

Lines changed: 2342 additions & 2040 deletions

File tree

package-lock.json

Lines changed: 2318 additions & 2035 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"react-leaflet": "^3.2.5",
9696
"react-leaflet-bing-v2": "^5.2.3",
9797
"react-leaflet-markercluster": "^4.2.1",
98+
"react-markdown": "^8.0.7",
9899
"react-onclickoutside": "^6.6.3",
99100
"react-popper": "^2.2.4",
100101
"react-query": "^3.34.2",
@@ -108,7 +109,7 @@
108109
"react-tagsinput": "^3.19.0",
109110
"redux": "^4.1.2",
110111
"redux-thunk": "^2.4.0",
111-
"react-markdown": "^8.0.7",
112+
"remark-gfm": "^3.0.1",
112113
"route-matcher": "^0.1.0",
113114
"sass": "^1.69.5",
114115
"stale-lru-cache": "^5.1.1",

src/components/CardChallenge/CardChallenge.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ export class CardChallenge extends Component {
165165
<div className="mr-card-challenge__description">
166166
<MarkdownContent
167167
markdown={this.props.challenge.description || this.props.challenge.blurb}
168+
allowPropertyReplacement
169+
allowShortCodes
168170
/>
169171
</div>
170172

src/components/ChallengeDetail/ChallengeDetail.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,11 @@ export class ChallengeDetail extends Component {
351351
this.state.showMore ? "mr-max-h-full" : ""
352352
}`}
353353
>
354-
<MarkdownContent markdown={challenge.description || challenge.blurb} />
354+
<MarkdownContent
355+
markdown={challenge.description || challenge.blurb}
356+
allowPropertyReplacement
357+
allowShortCodes
358+
/>
355359
</div>
356360
{this.state.hasOverflow && (
357361
<button

src/components/ChallengePane/ChallengeResultItem/ChallengeResultItem.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,12 @@ export class ChallengeResultItem extends Component {
137137
</span>
138138
</div>
139139
)}
140-
<MarkdownContent markdown={this.props.challenge.description} lightMode={false} />
140+
<MarkdownContent
141+
markdown={this.props.challenge.description}
142+
allowPropertyReplacement
143+
allowShortCodes
144+
lightMode={false}
145+
/>
141146
<div>
142147
<button
143148
type="button"

src/components/MarkdownContent/MarkdownContent.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from "classnames";
22
import PropTypes from "prop-types";
33
import ReactMarkdown from "react-markdown";
4+
import remarkGfm from "remark-gfm";
45
import usePropertyReplacement from "../../hooks/UsePropertyReplacement/UsePropertyReplacement";
56
import { processTextContent } from "../../services/Templating/Templating";
67

@@ -47,10 +48,10 @@ const MarkdownContent = ({
4748

4849
return <Component {...componentProps}>{processedChildren}</Component>;
4950
};
50-
5151
return (
5252
<div className={classNames("mr-markdown", { "mr-markdown--compact": compact }, className)}>
5353
<ReactMarkdown
54+
remarkPlugins={[remarkGfm]}
5455
components={{
5556
a: ({ _node, ...linkProps }) => (
5657
<a {...linkProps} target="_blank" rel="nofollow noreferrer" />

src/components/TaskPane/MobileTaskDetails/MobileTaskDetails.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ export default class MobileTaskDetails extends Component {
4545
<div className="mobile-task-details__info__description">
4646
<MarkdownContent
4747
markdown={this.props.task.parent.description || this.props.task.parent.blurb}
48+
allowPropertyReplacement
49+
allowShortCodes
4850
/>
4951
</div>
5052
</div>

src/pages/Social/Social.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ const ChallengeItem = (props) => {
119119
<FormattedDate value={parseISO(props.challenge.created)} />
120120
</div>
121121
<div className="mr-text-white mr-break-words">
122-
<MarkdownContent markdown={props.challenge.description} />
122+
<MarkdownContent
123+
markdown={props.challenge.description}
124+
allowPropertyReplacement
125+
allowShortCodes
126+
/>
123127
</div>
124128
</li>
125129
);

0 commit comments

Comments
 (0)