From 57b719c163a6e53cd80a38c107c1e88be3580e59 Mon Sep 17 00:00:00 2001
From: jaywcjlove <398188662@qq.com>
Date: Sat, 3 Sep 2022 15:39:06 +0800
Subject: [PATCH] feat: add documemt.
---
README.md | 33 +++++++++++++++++++++++++++------
src/App.tsx | 2 ++
src/components/Layout.tsx | 1 +
src/index.tsx | 4 +++-
src/pages/docs/index.tsx | 17 +++++++++++++++++
src/pages/home/index.tsx | 2 +-
src/pages/theme/editor.tsx | 6 +-----
7 files changed, 52 insertions(+), 13 deletions(-)
create mode 100644 src/pages/docs/index.tsx
diff --git a/README.md b/README.md
index d2616b4..6a0fec1 100644
--- a/README.md
+++ b/README.md
@@ -66,13 +66,20 @@ Inline Code `{code: 0}`
### 支持注释
+```html
- 汉
- 字
- 拼
- 音
- 注
- 音
+ 汉
+
+```
+
+汉字注音效果:
+
+ 汉
+ 字
+ 拼
+ 音
+ 注
+ 音
### 支持自定义样式
@@ -100,6 +107,20 @@ Inline Code `{code: 0}`
内容在微信 Markdown 编辑器预览中不显示。在其它预览工具中展示内容。
```
+### 支持 URL 参数加载 Markdown 内容
+
+```
+https://?md=
+```
+
+加载 Markdown 内容的示例 URL:
+
+```
+https://jaywcjlove.github.io/wxmp/#/?theme=underscore&md=https%3A%2F%2Fraw.githubusercontent.com%2Fuiwjs%2Freact-markdown-editor%2Fmaster%2FREADME.md
+
+Markdown URL 地址: https://raw.githubusercontent.com/uiwjs/react-markdown-editor/master/README.md
+```
+
## 主题定制
在目录 `src/themes` 中存放默认主题,在 `src/store/context.tsx` 中配置主题,主题使用 css 定义样式,不支持复杂的选择器。提供在线主题编辑器,欢迎修改并 PR 进仓库供大家使用。
diff --git a/src/App.tsx b/src/App.tsx
index 6a1063b..0c3c8c0 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -2,6 +2,7 @@ import { Routes, Route } from 'react-router-dom';
import { Layout } from './components/Layout';
import { HomePage } from './pages/home';
import { EditorPage } from './pages/theme/editor';
+import { DocsPage } from './pages/docs';
export default function App() {
return (
@@ -9,6 +10,7 @@ export default function App() {
}>
} />
} />
+ } />
);
diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx
index 80af169..1b2e560 100644
--- a/src/components/Layout.tsx
+++ b/src/components/Layout.tsx
@@ -88,6 +88,7 @@ export function Layout() {
首页
编辑主题
+ 文档
diff --git a/src/index.tsx b/src/index.tsx
index e87fa18..85f50d6 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -52,12 +52,14 @@ export const GlobalStyle = createGlobalStyle`
}
`;
+const style: React.CSSProperties = { zIndex: 999 };
+
const container = document.getElementById('root');
const root = createRoot(container!);
root.render(
- Top
+ Top
diff --git a/src/pages/docs/index.tsx b/src/pages/docs/index.tsx
new file mode 100644
index 0000000..ef1812d
--- /dev/null
+++ b/src/pages/docs/index.tsx
@@ -0,0 +1,17 @@
+import MarkdownEditor from '@uiw/react-markdown-editor';
+import styled from 'styled-components';
+import data from '../../../README.md';
+
+const Warpper = styled.div`
+ max-width: 59rem;
+ margin: 0 auto 0 auto;
+ padding: 0 1rem 3rem 1rem;
+`;
+
+export const DocsPage = () => {
+ return (
+
+
+
+ );
+};
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 325ba23..98e0bb9 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -8,7 +8,7 @@ import { theme as themeCommand, previeTheme } from '../../commands/theme';
import { cssCommand } from '../../commands/css';
import { Context, themes } from '../../store/context';
-const Warpper = styled.div`
+export const Warpper = styled.div`
height: calc(100vh - 2.9rem);
`;
diff --git a/src/pages/theme/editor.tsx b/src/pages/theme/editor.tsx
index 8b0e37c..5c8c71b 100644
--- a/src/pages/theme/editor.tsx
+++ b/src/pages/theme/editor.tsx
@@ -1,7 +1,6 @@
import MarkdownEditor, { IMarkdownEditor } from '@uiw/react-markdown-editor';
import { useContext } from 'react';
import { EditorView } from '@codemirror/view';
-import styled from 'styled-components';
import { css as cssLang } from '@codemirror/lang-css';
import { Preview } from './Preview';
import { copy } from '../../commands/copy';
@@ -9,10 +8,7 @@ import { previousCommand } from '../../commands/css';
import { themeTitle } from '../../commands/title';
import { theme as themeCommand, previeTheme } from '../../commands/theme';
import { Context, themes } from '../../store/context';
-
-const Warpper = styled.div`
- height: calc(100vh - 2.9rem);
-`;
+import { Warpper } from '../home';
export const EditorPage = () => {
const commands = [themeTitle, themeCommand, previousCommand];