Skip to content

Commit d950c74

Browse files
authored
Fix rendering markdown links (metabase#18417)
1 parent 49dd636 commit d950c74

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

frontend/src/metabase/visualizations/visualizations/Text.jsx

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable react/prop-types */
22
import React, { Component } from "react";
33
import ReactMarkdown from "react-markdown";
4+
import remarkGfm from "remark-gfm";
45
import styles from "./Text.css";
56

67
import cx from "classnames";
@@ -20,6 +21,8 @@ const getSettingsStyle = settings => ({
2021
"justify-end": settings["text.align_vertical"] === "bottom",
2122
});
2223

24+
const REMARK_PLUGINS = [remarkGfm];
25+
2326
export default class Text extends Component {
2427
props: VisualizationProps;
2528
state: State;
@@ -109,6 +112,7 @@ export default class Text extends Component {
109112
<div className={cx(className, styles.Text)}>
110113
{this.props.isPreviewing ? (
111114
<ReactMarkdown
115+
remarkPlugins={REMARK_PLUGINS}
112116
className={cx(
113117
"full flex-full flex flex-column text-card-markdown",
114118
styles["text-card-markdown"],
@@ -145,6 +149,7 @@ export default class Text extends Component {
145149
})}
146150
>
147151
<ReactMarkdown
152+
remarkPlugins={REMARK_PLUGINS}
148153
className={cx(
149154
"full flex-full flex flex-column text-card-markdown",
150155
styles["text-card-markdown"],

frontend/test/metabase/scenarios/dashboard/text-box.cy.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe("scenarios > dashboard > text-box", () => {
9595
.scrollTo("bottom");
9696
});
9797

98-
it.skip("should literal links, and not just the markdown flavor of it (metabse#18114)", () => {
98+
it("should render html links, and not just the markdown flavor of them (metabase#18114)", () => {
9999
addTextBox(
100100
"- Visit https://www.metabase.com{enter}- Or go to [Metabase](https://www.metabase.com)",
101101
);

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"redux-router": "^2.1.2",
8484
"regenerator": "^0.14.1",
8585
"regexp.escape": "^1.1.0",
86+
"remark-gfm": "1.0.0",
8687
"reselect": "^3.0.0",
8788
"resize-observer-polyfill": "^1.5.1",
8889
"screenfull": "^4.2.1",

yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -13442,7 +13442,7 @@ relateurl@^0.2.7:
1344213442
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
1344313443
integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=
1344413444

13445-
remark-gfm@^1.0.0:
13445+
remark-gfm@1.0.0, remark-gfm@^1.0.0:
1344613446
version "1.0.0"
1344713447
resolved "https://registry.yarnpkg.com/remark-gfm/-/remark-gfm-1.0.0.tgz#9213643001be3f277da6256464d56fd28c3b3c0d"
1344813448
integrity sha512-KfexHJCiqvrdBZVbQ6RopMZGwaXz6wFJEfByIuEwGf0arvITHjiKKZ1dpXujjH9KZdm1//XJQwgfnJ3lmXaDPA==

0 commit comments

Comments
 (0)