Skip to content

Commit a9a7310

Browse files
committed
website: update markdown preview.
1 parent 04dbddd commit a9a7310

File tree

8 files changed

+44
-244
lines changed

8 files changed

+44
-244
lines changed

core/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $ npm install @uiw/react-markdown-preview --save
3232

3333
[![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?logo=codesandbox)](https://codesandbox.io/embed/react-markdown-preview-co1mj?fontsize=14&hidenavigation=1&theme=dark)
3434

35-
```jsx mdx:preview
35+
```jsx mdx:preview&checkered=0
3636
import React from 'react';
3737
import MarkdownPreview from '@uiw/react-markdown-preview';
3838

@@ -51,7 +51,7 @@ export default function Demo() {
5151

5252
## Disable Header links
5353

54-
```jsx mdx:preview
54+
```jsx mdx:preview&checkered=0
5555
import React from 'react';
5656
import MarkdownPreview from '@uiw/react-markdown-preview';
5757

@@ -81,7 +81,7 @@ export default function Demo() {
8181

8282
syntax: <code>```jsx {1,4-5}</code>
8383

84-
```jsx mdx:preview?background=#fff
84+
```jsx mdx:preview
8585
import React from 'react';
8686
import MarkdownPreview from '@uiw/react-markdown-preview';
8787

website/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,9 @@
77
"start": "kkt start"
88
},
99
"dependencies": {
10-
"@uiw/react-back-to-top": "^1.2.0",
11-
"@uiw/react-codesandbox": "~1.1.4",
12-
"@uiw/react-github-corners": "~1.5.3",
13-
"@uiw/react-markdown-preview": "^4.1.13",
14-
"@uiw/react-shields": "~1.1.2",
15-
"@uiw/reset.css": "~1.0.5",
16-
"@wcj/dark-mode": "~1.0.9",
10+
"@uiw/react-markdown-preview-example": "^1.5.5",
11+
"@uiw/react-shields": "^1.1.3",
1712
"react": "~18.2.0",
18-
"react-code-preview-layout": "^3.0.0",
1913
"react-dom": "~18.2.0",
2014
"react-router-dom": "^6.8.1"
2115
},

website/src/App.css

Lines changed: 0 additions & 95 deletions
This file was deleted.

website/src/App.tsx

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,26 @@
1-
import { useState } from 'react';
2-
import GitHubCorners from '@uiw/react-github-corners';
31
import Github from '@uiw/react-shields/esm/github';
42
import Npm from '@uiw/react-shields/esm/npm';
5-
import BackToUp from '@uiw/react-back-to-top';
6-
import MarkdownPreview from '@uiw/react-markdown-preview';
7-
import '@wcj/dark-mode';
8-
import logo from './logo.svg';
9-
import { Preview } from './preview';
10-
import './App.css';
3+
import styled from 'styled-components';
114

12-
let val = 1;
5+
const Footer = styled.footer`
6+
text-align: center;
7+
padding-top: 30px;
8+
`;
139

1410
const App = () => {
15-
const [value, setValue] = useState('');
1611
return (
17-
<div className="App">
18-
<BackToUp>Top</BackToUp>
19-
<dark-mode permanent light="Light" dark="Dark"></dark-mode>
20-
<GitHubCorners zIndex={9999} fixed target="__blank" href="https://github.com/uiwjs/react-markdown-preview" />
21-
<header className="App-header">
22-
<img style={{}} src={logo} className="App-logo" alt="logo" />
23-
<a href="https://github.com/uiwjs/react-markdown-preview" target="_blank" rel="noopener noreferrer">
24-
React Markdown Preview
25-
</a>
26-
<p>
27-
React component preview markdown text in web browser. The minimal amount of CSS to replicate the GitHub
28-
Markdown style.
29-
</p>
30-
</header>
31-
<div className="App-editor">
32-
<button onClick={() => setValue('# Markdown ' + val++)}>set value</button>
33-
34-
<textarea
35-
placeholder="Please enter the Markdown code!"
36-
value={value}
37-
spellCheck="false"
38-
onChange={(e) => setValue(e.target.value)}
39-
/>
40-
<MarkdownPreview className="App-editor-preview" source={value} />
41-
</div>
42-
<Preview />
43-
<div className="App-footer">
44-
<Github user="uiwjs" repo="react-markdown-preview">
45-
<Github.Social type="forks" href="https://github.com/uiwjs/react-markdown-preview" />
46-
<Github.Social type="stars" href="https://github.com/uiwjs/react-markdown-preview/stargazers" />
47-
<Github.Social type="watchers" href="https://github.com/uiwjs/react-markdown-preview/watchers" />
48-
</Github>
49-
<Npm.Version
50-
scope="@uiw"
51-
packageName="react-markdown-preview"
52-
href="https://www.npmjs.com/package/@uiw/react-markdown-preview"
53-
/>
54-
</div>
55-
</div>
12+
<Footer>
13+
<Github user="uiwjs" repo="react-markdown-preview">
14+
<Github.Social type="forks" href="https://github.com/uiwjs/react-markdown-preview" />
15+
<Github.Social type="stars" href="https://github.com/uiwjs/react-markdown-preview/stargazers" />
16+
<Github.Social type="watchers" href="https://github.com/uiwjs/react-markdown-preview/watchers" />
17+
</Github>
18+
<Npm.Version
19+
scope="@uiw"
20+
packageName="react-markdown-preview"
21+
href="https://www.npmjs.com/package/@uiw/react-markdown-preview"
22+
/>
23+
</Footer>
5624
);
5725
};
5826

website/src/index.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
import App from './App';
21
import { createRoot } from 'react-dom/client';
2+
import MarkdownPreviewExample from '@uiw/react-markdown-preview-example';
3+
import data from '@uiw/react-markdown-preview/README.md';
4+
import Example from './App';
35

46
const container = document.getElementById('root');
57
const root = createRoot(container!);
6-
root.render(<App />);
8+
root.render(
9+
<MarkdownPreviewExample
10+
source={data.source}
11+
components={data.components}
12+
data={data.data}
13+
title={
14+
<a href="https://github.com/uiwjs/react-markdown-preview" target="_blank" rel="noopener noreferrer">
15+
React Markdown Preview
16+
</a>
17+
}
18+
description="React component preview markdown text in web browser. The minimal amount of CSS to replicate the GitHub
19+
Markdown style."
20+
version={`v${VERSION}`}
21+
>
22+
<MarkdownPreviewExample.Github href="https://github.com/uiwjs/react-markdown-preview" />
23+
<Example />
24+
</MarkdownPreviewExample>,
25+
);

website/src/logo.svg

Lines changed: 0 additions & 7 deletions
This file was deleted.

website/src/preview/index.tsx

Lines changed: 0 additions & 71 deletions
This file was deleted.

website/src/react-app-env.d.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
/// <reference types="react-scripts" />
22

3-
declare module '*.module.less' {
4-
const classes: { readonly [key: string]: string };
5-
export default classes;
6-
}
7-
8-
declare module '*.less' {
9-
const src: string;
10-
export default src;
11-
}
3+
declare var VERSION: string;
124

135
declare module '*.md' {
146
import { CodeBlockData } from 'markdown-react-code-preview-loader';

0 commit comments

Comments
 (0)