Skip to content

Commit

Permalink
Merge pull request #404 from open-rpc/fix/add-syntax-highlighted-mark…
Browse files Browse the repository at this point in the history
…ddown

fix: add syntax highlighted markdown
  • Loading branch information
shanejonas authored Jan 13, 2021
2 parents 141b6d5 + 70f17bc commit 7d446ee
Show file tree
Hide file tree
Showing 11 changed files with 279 additions and 16 deletions.
7 changes: 4 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = {
"testEnvironment": "jsdom",
"testPathIgnorePatterns": ["./build"],
"preset": "ts-jest",
"transformIgnorePatterns": ['^.+\\.js$'],
"moduleNameMapper": {
"\\.(css|less|sass|scss)$": "jest-transform-css"
}
}
"\\.(css|less|sass|scss)$": "jest-transform-css",
},
};
166 changes: 166 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@material-ui/lab": "4.0.0-alpha.47",
"@material-ui/styles": "^4.7.1",
"@open-rpc/examples": "^1.6.1",
"@types/react-syntax-highlighter": "^13.5.0",
"@xops.net/json-schema-to-react-tree": "^1.0.2",
"hash-color-material": "^1.1.3",
"jest-transform-css": "^2.0.0",
Expand All @@ -24,7 +25,8 @@
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-json-view": "^1.19.1",
"react-markdown": "^4.0.6"
"react-markdown": "^4.0.6",
"react-syntax-highlighter": "^15.4.3"
},
"devDependencies": {
"@open-rpc/meta-schema": "^1.11.0",
Expand Down
7 changes: 6 additions & 1 deletion src/ContentDescriptor/ContentDescriptor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ReactMarkdown from "react-markdown";
import JSONSchemaTree from "@xops.net/json-schema-to-react-tree";
import { ContentDescriptorObject } from "@open-rpc/meta-schema";
import "./ContentDescriptor.css";
import MarkdownDescription from "../MarkdownDescription/MarkdownDescription";

const styles = (theme: Theme) => ({
description: {
Expand Down Expand Up @@ -60,7 +61,11 @@ class ContentDescriptor extends Component<IProps> {
<ExpansionPanelDetails style={{ display: "block", overflowX: "auto" }}>
<>
{contentDescriptor.description &&
<ReactMarkdown source={contentDescriptor.description} className={classes.description} />
<MarkdownDescription
uiSchema={uiSchema}
source={contentDescriptor.description}
className={classes.description}
/>
}
{contentDescriptor.schema &&
<>
Expand Down
Loading

0 comments on commit 7d446ee

Please sign in to comment.