Skip to content

Commit 7d446ee

Browse files
authored
Merge pull request #404 from open-rpc/fix/add-syntax-highlighted-markddown
fix: add syntax highlighted markdown
2 parents 141b6d5 + 70f17bc commit 7d446ee

File tree

11 files changed

+279
-16
lines changed

11 files changed

+279
-16
lines changed

jest.config.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module.exports = {
77
"testEnvironment": "jsdom",
88
"testPathIgnorePatterns": ["./build"],
99
"preset": "ts-jest",
10+
"transformIgnorePatterns": ['^.+\\.js$'],
1011
"moduleNameMapper": {
11-
"\\.(css|less|sass|scss)$": "jest-transform-css"
12-
}
13-
}
12+
"\\.(css|less|sass|scss)$": "jest-transform-css",
13+
},
14+
};

package-lock.json

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

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"@material-ui/lab": "4.0.0-alpha.47",
1717
"@material-ui/styles": "^4.7.1",
1818
"@open-rpc/examples": "^1.6.1",
19+
"@types/react-syntax-highlighter": "^13.5.0",
1920
"@xops.net/json-schema-to-react-tree": "^1.0.2",
2021
"hash-color-material": "^1.1.3",
2122
"jest-transform-css": "^2.0.0",
@@ -24,7 +25,8 @@
2425
"react": "^16.12.0",
2526
"react-dom": "^16.12.0",
2627
"react-json-view": "^1.19.1",
27-
"react-markdown": "^4.0.6"
28+
"react-markdown": "^4.0.6",
29+
"react-syntax-highlighter": "^15.4.3"
2830
},
2931
"devDependencies": {
3032
"@open-rpc/meta-schema": "^1.11.0",

src/ContentDescriptor/ContentDescriptor.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ReactMarkdown from "react-markdown";
99
import JSONSchemaTree from "@xops.net/json-schema-to-react-tree";
1010
import { ContentDescriptorObject } from "@open-rpc/meta-schema";
1111
import "./ContentDescriptor.css";
12+
import MarkdownDescription from "../MarkdownDescription/MarkdownDescription";
1213

1314
const styles = (theme: Theme) => ({
1415
description: {
@@ -60,7 +61,11 @@ class ContentDescriptor extends Component<IProps> {
6061
<ExpansionPanelDetails style={{ display: "block", overflowX: "auto" }}>
6162
<>
6263
{contentDescriptor.description &&
63-
<ReactMarkdown source={contentDescriptor.description} className={classes.description} />
64+
<MarkdownDescription
65+
uiSchema={uiSchema}
66+
source={contentDescriptor.description}
67+
className={classes.description}
68+
/>
6469
}
6570
{contentDescriptor.schema &&
6671
<>

0 commit comments

Comments
 (0)