You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ki...@apache.org on 2020/12/29 02:11:53 UTC

[incubator-dolphinscheduler-website] branch master updated: Support md and jsx page in community and refactor community (#234)

This is an automated email from the ASF dual-hosted git repository.

kirs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 586d978  Support md and jsx page in community and refactor community (#234)
586d978 is described below

commit 586d9783f8e7f3f875e2eb7a6e2210e0d06c286e
Author: Shiwen Cheng <ch...@gmail.com>
AuthorDate: Tue Dec 29 10:11:47 2020 +0800

    Support md and jsx page in community and refactor community (#234)
    
    * support md and jsx page in community
    
    * add baidu tongji code in ejs template
    
    * refactor community docs
    
    * add component md2html to resolve duplicated code of index.md.jsx
    
    * adjust html style for redirect.ejs
---
 .gitignore                                         |   1 +
 .../en-us/community => community/en-us}/example.md |   0
 .../en-us/community => community/en-us}/release.md |   0
 .../community => community/en-us}/security.md      |   0
 {docs/en-us/community => community/en-us}/team.md  |   0
 .../zh-cn/community => community/zh-cn}/example.md |   0
 index.html                                         |  34 ----
 md_json/blog.json                                  |  36 ----
 md_json/docs.json                                  | 191 ---------------------
 package.json                                       |   2 +-
 redirect.ejs                                       |  14 +-
 site_config/community.js                           |  67 --------
 site_config/community.jsx                          |  47 +++--
 site_config/site.js                                |  14 +-
 .../blogDetail => components/md2html}/index.jsx    |  38 +---
 .../md2html}/index.scss                            |   2 +-
 src/pages/blogDetail/index.md.jsx                  |  35 ++++
 src/pages/blogDetail/{index.scss => index.md.scss} |   0
 src/pages/community/index.jsx                      |   7 +-
 src/pages/community/index.md.jsx                   |  43 +++++
 src/pages/documentation/index.jsx                  | 146 ----------------
 src/pages/documentation/index.md.jsx               |  66 +++++++
 template.ejs                                       |  13 +-
 webpack.config.js                                  |  23 ++-
 24 files changed, 242 insertions(+), 537 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7d38661..861615b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,4 @@ t.*
 yarn.lock
 package-lock.json
 config.gypi
+md_json
diff --git a/docs/en-us/community/example.md b/community/en-us/example.md
similarity index 100%
rename from docs/en-us/community/example.md
rename to community/en-us/example.md
diff --git a/docs/en-us/community/release.md b/community/en-us/release.md
similarity index 100%
rename from docs/en-us/community/release.md
rename to community/en-us/release.md
diff --git a/docs/en-us/community/security.md b/community/en-us/security.md
similarity index 100%
rename from docs/en-us/community/security.md
rename to community/en-us/security.md
diff --git a/docs/en-us/community/team.md b/community/en-us/team.md
similarity index 100%
rename from docs/en-us/community/team.md
rename to community/en-us/team.md
diff --git a/docs/zh-cn/community/example.md b/community/zh-cn/example.md
similarity index 100%
rename from docs/zh-cn/community/example.md
rename to community/zh-cn/example.md
diff --git a/index.html b/index.html
deleted file mode 100644
index 7784fe8..0000000
--- a/index.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-	<title>Apache DolphinScheduler is a distributed and easy-to-expand visual DAG workflow scheduling system, dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing.</title>
-	<meta charset="UTF-8"/>
-	<meta name="description" content="DolphinScheduler is a distributed and easy-to-extend visual DAG workflow scheduling system, dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing."/>
-	<meta name="keywords" content="DolphinScheduler Official Website,dolphinscheduler.apache.org"/>
-</head>
-
-
-	
-<body>
-<script>
-var _hmt = _hmt || [];
-(function() {
-  var hm = document.createElement("script");
-  hm.src = "https://hm.baidu.com/hm.js?4e7b4b400dd31fa015018a435c64d06f";
-  var s = document.getElementsByTagName("script")[0]; 
-  s.parentNode.insertBefore(hm, s);
-})();
-</script>
-
-  <script src="//cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
-	<script>
-    window.rootPath = '';
-    window.defaultLanguage = 'en-us';
-    var lang = Cookies.get('docsite_language');
-    if (!lang) {
-      lang = 'en-us';
-    }
-    window.location =window.rootPath + '/' + lang;
-  </script>
-</body>
-</html>
diff --git a/md_json/blog.json b/md_json/blog.json
deleted file mode 100755
index 2d5b068..0000000
--- a/md_json/blog.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
-  "en-us": [
-    {
-      "filename": "architecture-design.md",
-      "link": "/en-us/blog/architecture-design.html",
-      "meta": {}
-    },
-    {
-      "filename": "meetup_2019_10_26.md",
-      "link": "/en-us/blog/meetup_2019_10_26.html",
-      "meta": {}
-    },
-    {
-      "filename": "live_online_2020_05_26.md",
-      "link": "/en-us/blog/live_online_2020_05_26.html",
-      "meta": {}
-    }
-  ],
-  "zh-cn": [
-    {
-      "filename": "architecture-design.md",
-      "link": "/zh-cn/blog/architecture-design.html",
-      "meta": {}
-    },
-    {
-      "filename": "meetup_2019_10_26.md",
-      "link": "/zh-cn/blog/meetup_2019_10_26.html",
-      "meta": {}
-    },
-    {
-      "filename": "live_online_2020_05_26.md",
-      "link": "/zh-cn/blog/live_online_2020_05_26.html",
-      "meta": {}
-    }
-  ]
-}
\ No newline at end of file
diff --git a/md_json/docs.json b/md_json/docs.json
deleted file mode 100755
index 7d93170..0000000
--- a/md_json/docs.json
+++ /dev/null
@@ -1,191 +0,0 @@
-{
-  "en-us": [
-    {
-      "filename": "contribute.md",
-      "link": "/en-us/docs/development/contribute.html",
-      "meta": {}
-    },
-    {
-      "filename": "submit-code.md",
-      "link": "/en-us/docs/development/submit-code.html",
-      "meta": {}
-    },
-    {
-      "filename": "architecture-design.md",
-      "link": "/en-us/docs/development/architecture-design.html",
-      "meta": {}
-    },
-    {
-      "filename": "backend-development.md",
-      "link": "/en-us/docs/development/backend-development.html",
-      "meta": {}
-    },
-    {
-      "filename": "unit-test.md",
-      "link": "/en-us/docs/development/unit-test.html",
-      "meta": {}
-    },
-    {
-      "filename": "developers.md",
-      "link": "/en-us/docs/development/developers.html",
-      "meta": {}
-    },
-    {
-      "filename": "DS-License.md",
-      "link": "/en-us/docs/development/DS-License.html",
-      "meta": {}
-    },
-    {
-      "filename": "frontend-development.md",
-      "link": "/en-us/docs/development/frontend-development.html",
-      "meta": {}
-    },
-    {
-      "filename": "plugin-development.md",
-      "link": "/en-us/docs/development/plugin-development.html",
-      "meta": {}
-    },
-    {
-      "filename": "faq.md",
-      "link": "/en-us/docs/release/faq.html",
-      "meta": {}
-    },
-    {
-      "filename": "upgrade.md",
-      "link": "/en-us/docs/release/upgrade.html",
-      "meta": {}
-    },
-    {
-      "filename": "hardware-environment.md",
-      "link": "/en-us/docs/user_doc/hardware-environment.html",
-      "meta": {}
-    },
-    {
-      "filename": "standalone-deployment.md",
-      "link": "/en-us/docs/user_doc/standalone-deployment.html",
-      "meta": {}
-    },
-    {
-      "filename": "cluster-deployment.md",
-      "link": "/en-us/docs/user_doc/cluster-deployment.html",
-      "meta": {}
-    },
-    {
-      "filename": "subscribe.md",
-      "link": "/en-us/docs/development/subscribe.html",
-      "meta": {}
-    },
-    {
-      "filename": "quick-start.md",
-      "link": "/en-us/docs/user_doc/quick-start.html",
-      "meta": {}
-    },
-    {
-      "filename": "system-manual.md",
-      "link": "/en-us/docs/user_doc/system-manual.html",
-      "meta": {}
-    }
-  ],
-  "zh-cn": [
-    {
-      "filename": "contribute.md",
-      "link": "/zh-cn/docs/development/contribute.html",
-      "meta": {}
-    },
-    {
-      "filename": "submit-code.md",
-      "link": "/zh-cn/docs/development/submit-code.html",
-      "meta": {}
-    },
-    {
-      "filename": "DS-License.md",
-      "link": "/zh-cn/docs/development/DS-License.html",
-      "meta": {}
-    },
-    {
-      "filename": "commit-message.md",
-      "link": "/zh-cn/docs/development/commit-message.html",
-      "meta": {}
-    },
-    {
-      "filename": "architecture-design.md",
-      "link": "/zh-cn/docs/development/architecture-design.html",
-      "meta": {}
-    },
-    {
-      "filename": "backend-development.md",
-      "link": "/zh-cn/docs/development/backend-development.html",
-      "meta": {}
-    },
-    {
-      "filename": "unit-test.md",
-      "link": "/zh-cn/docs/development/unit-test.html",
-      "meta": {}
-    },
-    {
-      "filename": "developers.md",
-      "link": "/zh-cn/docs/development/developers.html",
-      "meta": {}
-    },
-    {
-      "filename": "frontend-development.md",
-      "link": "/zh-cn/docs/development/frontend-development.html",
-      "meta": {}
-    },
-    {
-      "filename": "plugin-development.md",
-      "link": "/zh-cn/docs/development/plugin-development.html",
-      "meta": {}
-    },
-    {
-      "filename": "development-environment-setup.md",
-      "link": "/zh-cn/docs/development/development-environment-setup.html",
-      "meta": {}
-    },
-    {
-      "filename": "microbench.md",
-      "link": "/zh-cn/docs/development/microbench.html",
-      "meta": {}
-    },
-    {
-      "filename": "faq.md",
-      "link": "/zh-cn/docs/faq.html",
-      "meta": {}
-    },
-    {
-      "filename": "upgrade.md",
-      "link": "/zh-cn/docs/release/upgrade.html",
-      "meta": {}
-    },
-    {
-      "filename": "hardware-environment.md",
-      "link": "/zh-cn/docs/user_doc/hardware-environment.html",
-      "meta": {}
-    },
-    {
-      "filename": "standalone-deployment.md",
-      "link": "/zh-cn/docs/user_doc/standalone-deployment.html",
-      "meta": {}
-    },
-    {
-      "filename": "cluster-deployment.md",
-      "link": "/zh-cn/docs/user_doc/cluster-deployment.html",
-      "meta": {}
-    },
-    {
-      "filename": "subscribe.md",
-      "link": "/zh-cn/docs/development/subscribe.html",
-      "meta": {}
-    },
-    {
-      "filename": "quick-start.md",
-      "link": "/zh-cn/docs/user_doc/quick-start.html",
-      "meta": {}
-    },
-    {
-      "filename": "system-manual.md",
-      "link": "/zh-cn/docs/user_doc/system-manual.html",
-      "meta": {}
-    }
-  ]
-}
diff --git a/package.json b/package.json
index 7d17d12..133d52c 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
     "babel-register": "^6.26.0",
     "compression-webpack-plugin": "^3.1.0",
     "css-loader": "0.6.12",
-    "docsite": "^1.3.9",
+    "docsite-ext": "1.4.1",
     "eslint": "^4.18.2",
     "eslint-config-ali": "^1.0.0",
     "eslint-plugin-import": "*",
diff --git a/redirect.ejs b/redirect.ejs
index eac1330..3cab04c 100755
--- a/redirect.ejs
+++ b/redirect.ejs
@@ -1,7 +1,10 @@
 <!DOCTYPE html>
 <html lang="en">
 <head>
-	<meta charset="UTF-8">
+  <title>Apache DolphinScheduler is a distributed and easy-to-expand visual DAG workflow scheduling system, dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing.</title>
+  <meta charset="UTF-8"/>
+  <meta name="description" content="DolphinScheduler is a distributed and easy-to-extend visual DAG workflow scheduling system, dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing."/>
+  <meta name="keywords" content="DolphinScheduler Official Website,dolphinscheduler.apache.org"/>
 </head>
 <body>
   <script src="//cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
@@ -14,5 +17,14 @@
     }
     window.location = window.rootPath + '/' + lang;
   </script>
+  <script>
+    var _hmt = _hmt || [];
+    (function() {
+      var hm = document.createElement("script");
+      hm.src = "https://hm.baidu.com/hm.js?4e7b4b400dd31fa015018a435c64d06f";
+      var s = document.getElementsByTagName("script")[0];
+      s.parentNode.insertBefore(hm, s);
+    })();
+  </script>
 </body>
 </html>
\ No newline at end of file
diff --git a/site_config/community.js b/site_config/community.js
deleted file mode 100644
index e48e1ed..0000000
--- a/site_config/community.js
+++ /dev/null
@@ -1,67 +0,0 @@
-export default {
-    'en-us': {
-      sidemenu: [
-        {
-          title: 'Community',
-          children: [
-            {
-              title: 'Community News',
-              link: '/en-us/community/index.html',
-            }
-          ],
-        },
-        {
-          title: 'Team',
-          children: [
-            {
-              title: 'team introduce',
-              link: '/en-us/docs/community/team.html',
-            }
-          ]
-        },
-        {
-          title: 'Security',
-          children: [
-            {
-              title: 'security introduce',
-              link: '/en-us/docs/community/security.html',
-            }
-          ]
-        },
-        {
-          title: 'Release Guide',
-          children: [
-            {
-              title: 'release guide',
-              link: '/en-us/docs/community/release.html',
-            }
-          ]
-        },
-      ],
-      barText: 'Community'
-    },
-    'zh-cn': {
-      sidemenu: [
-        {
-          title: '社区动态',
-          children: [
-            {
-              title: '社区动态',
-              link: '/zh-cn/community/index.html',
-            }
-          ],
-        },
-        {
-            title: '示例',
-            children: [
-              {
-                title: '示例页面',
-                link: '/zh-cn/docs/community/example.html',
-              }
-            ],
-          }
-      ],
-      barText: '社区',
-    },
-  };
-
diff --git a/site_config/community.jsx b/site_config/community.jsx
index 1d62832..7e4ff20 100755
--- a/site_config/community.jsx
+++ b/site_config/community.jsx
@@ -6,17 +6,40 @@ export default {
     sidemenu: [
       {
         title: 'Community News',
-        children: []
+        children: [
+          {
+            title: 'Community News',
+            link: '/en-us/community/index.html',
+          }
+        ],
       },
       {
-        title: 'example',
+        title: 'Team',
         children: [
           {
-            title: 'example page',
-            link: '/en-us/docs/community/example.html',
-          },
-        ]
-      }
+            title: 'team introduce',
+            link: '/en-us/community/team.html',
+          }
+        ],
+      },
+      {
+        title: 'Security',
+        children: [
+          {
+            title: 'security introduce',
+            link: '/en-us/community/security.html',
+          }
+        ],
+      },
+      {
+        title: 'Release Guide',
+        children: [
+          {
+            title: 'release guide',
+            link: '/en-us/community/release.html',
+          }
+        ],
+      },
     ],
     events: {
       title: 'Events & News',
@@ -124,17 +147,17 @@ export default {
           {
             title: '社区动态',
             link: '/zh-cn/community/index.html',
-          },
-        ]
+          }
+        ],
       },
       {
         title: '示例',
         children: [
           {
             title: '示例页面',
-            link: '/zh-cn/docs/community/example.html',
-          },
-        ]
+            link: '/zh-cn/community/example.html',
+          }
+        ],
       }
     ],
     events: {
diff --git a/site_config/site.js b/site_config/site.js
index 09e9735..f68b98d 100755
--- a/site_config/site.js
+++ b/site_config/site.js
@@ -74,6 +74,18 @@ export default {
         key: 'community',
         text: 'COMMUNITY',
         link: '/en-us/community/index.html',
+        children: [
+          {
+            key: 'community',
+            text: 'COMMUNITY NEWS',
+            link: '/en-us/community/index.html',
+          },
+          {
+            key: 'example',
+            text: 'EXAMPLE',
+            link: '/en-us/community/example.html',
+          }
+        ]
       },
       {
         key: 'ASF',
@@ -250,7 +262,7 @@ export default {
           {
             key: 'example',
             text: '示例页面',
-            link: '/zh-cn/docs/community/example.html',
+            link: '/zh-cn/community/example.html',
           }
         ]
       },
diff --git a/src/pages/blogDetail/index.jsx b/src/components/md2html/index.jsx
old mode 100755
new mode 100644
similarity index 69%
rename from src/pages/blogDetail/index.jsx
rename to src/components/md2html/index.jsx
index 97a7a75..c0103e2
--- a/src/pages/blogDetail/index.jsx
+++ b/src/components/md2html/index.jsx
@@ -1,18 +1,13 @@
-import React from 'react';
-import ReactDOM from 'react-dom';
 import { scroller } from 'react-scroll';
 import path from 'path';
 import 'whatwg-fetch'; // fetch polyfill
-import Language from '../../components/language';
-import Header from '../../components/header';
-import Footer from '../../components/footer';
 import './index.scss';
 
-// 锚点正则
 const anchorReg = /^#[^/]/;
 // 相对地址正则,包括./、../、直接文件夹名称开头、直接文件开头
 const relativeReg = /^((\.{1,2}\/)|([\w-]+[/.]))/;
-class BlogDetail extends Language {
+
+const Md2Html = ComposeComponent => class extends ComposeComponent {
 
   constructor(props) {
     super(props);
@@ -51,7 +46,7 @@ class BlogDetail extends Language {
   handleRelativeLink() {
     const language = this.getLanguage();
     // 获取当前文档所在文件系统中的路径
-    // rootPath/en-us/blog/dir/hello.html => /blog/en-us/dir
+    // rootPath/en-us/docs/dir/hello.html => /docs/en-us/dir
     const splitPart = window.location.pathname.replace(`${window.rootPath}/${language}`, '').split('/').slice(0, -1);
     const filePath = splitPart.join('/');
     const alinks = Array.from(this.markdownContainer.querySelectorAll('a'));
@@ -67,7 +62,7 @@ class BlogDetail extends Language {
   handleRelativeImg() {
     const language = this.getLanguage();
     // 获取当前文档所在文件系统中的路径
-    // rootPath/en-us/blog/dir/hello.html => /blog/en-us/dir
+    // rootPath/en-us/docs/dir/hello.html => /docs/en-us/dir
     const splitPart = window.location.pathname.replace(`${window.rootPath}/${language}`, '').split('/').slice(0, -1);
     splitPart.splice(2, 0, language);
     const filePath = splitPart.join('/');
@@ -81,29 +76,6 @@ class BlogDetail extends Language {
     });
   }
 
-  render() {
-    const language = this.getLanguage();
-    const __html = this.props.__html || this.state.__html;
-    return (
-      <div className="blog-detail-page">
-        <Header
-          type="normal"
-          currentKey="blog"
-          logo="/img/hlogo_colorful.svg"
-          language={language}
-          onLanguageChange={this.onLanguageChange}
-        />
-        <section
-          className="blog-content markdown-body"
-          ref={(node) => { this.markdownContainer = node; }}
-          dangerouslySetInnerHTML={{ __html }}
-        />
-        <Footer logo="/img/ds_gray.svg" language={language} />
-      </div>
-    );
-  }
 }
 
-document.getElementById('root') && ReactDOM.render(<BlogDetail />, document.getElementById('root'));
-
-export default BlogDetail;
+export default Md2Html;
diff --git a/src/pages/documentation/index.scss b/src/components/md2html/index.scss
old mode 100755
new mode 100644
similarity index 96%
rename from src/pages/documentation/index.scss
rename to src/components/md2html/index.scss
index a29ea51..f9f4dc7
--- a/src/pages/documentation/index.scss
+++ b/src/components/md2html/index.scss
@@ -2,7 +2,7 @@
 @import '../../reset.scss';
 @import '../../markdown.scss';
 
-.documentation-page {
+.md2html {
   .content-section {
     max-width: $contentWidth;
     margin: 0 auto;
diff --git a/src/pages/blogDetail/index.md.jsx b/src/pages/blogDetail/index.md.jsx
new file mode 100755
index 0000000..ad3ba24
--- /dev/null
+++ b/src/pages/blogDetail/index.md.jsx
@@ -0,0 +1,35 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import Language from '../../components/language';
+import Header from '../../components/header';
+import Footer from '../../components/footer';
+import Md2Html from '../../components/md2html';
+import './index.md.scss';
+
+class BlogDetail extends Md2Html(Language) {
+  render() {
+    const language = this.getLanguage();
+    const __html = this.props.__html || this.state.__html;
+    return (
+      <div className="blog-detail-page">
+        <Header
+          currentKey="blog"
+          type="normal"
+          logo="/img/hlogo_colorful.svg"
+          language={language}
+          onLanguageChange={this.onLanguageChange}
+        />
+        <section
+          className="blog-content markdown-body"
+          ref={(node) => { this.markdownContainer = node; }}
+          dangerouslySetInnerHTML={{ __html }}
+        />
+        <Footer logo="/img/dubbo_gray.png" language={language} />
+      </div>
+    );
+  }
+}
+
+document.getElementById('root') && ReactDOM.render(<BlogDetail />, document.getElementById('root'));
+
+export default BlogDetail;
diff --git a/src/pages/blogDetail/index.scss b/src/pages/blogDetail/index.md.scss
similarity index 100%
rename from src/pages/blogDetail/index.scss
rename to src/pages/blogDetail/index.md.scss
diff --git a/src/pages/community/index.jsx b/src/pages/community/index.jsx
index c0f09d9..dcb8952 100755
--- a/src/pages/community/index.jsx
+++ b/src/pages/community/index.jsx
@@ -2,16 +2,14 @@ import React from 'react';
 import ReactDOM from 'react-dom';
 import Language from '../../components/language';
 import Header from '../../components/header';
+import Footer from '../../components/footer';
 import Bar from '../../components/bar';
 import Sidemenu from '../../components/sidemenu';
 import Slider from '../../components/slider';
 import EventCard from './eventCard';
 import ContactItem from './contactItem';
 import ContributorItem from './contributorItem';
-import Footer from '../../components/footer';
 import communityConfig from '../../../site_config/community.jsx';
-import communityConfigs from '../../../site_config/community';
-
 import './index.scss';
 
 class Community extends Language {
@@ -19,9 +17,6 @@ class Community extends Language {
   render() {
     const language = this.getLanguage();
     let dataSource = communityConfig[language];
-    if (window.location.pathname.indexOf('/docs/community/') >= 0) {
-      dataSource = communityConfigs[language];
-    }
     return (
       <div className="community-page">
         <Header
diff --git a/src/pages/community/index.md.jsx b/src/pages/community/index.md.jsx
new file mode 100755
index 0000000..381538c
--- /dev/null
+++ b/src/pages/community/index.md.jsx
@@ -0,0 +1,43 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import Language from '../../components/language';
+import Header from '../../components/header';
+import Footer from '../../components/footer';
+import Md2Html from '../../components/md2html';
+import Bar from '../../components/bar';
+import Sidemenu from '../../components/sidemenu';
+import communityConfig from '../../../site_config/community.jsx';
+
+class Community extends Md2Html(Language) {
+
+  render() {
+    const language = this.getLanguage();
+    const dataSource = communityConfig[language];
+    const __html = this.props.__html || this.state.__html;
+    return (
+      <div className="md2html community-page">
+        <Header
+          currentKey="community"
+          type="normal"
+          logo="/img/hlogo_colorful.svg"
+          language={language}
+          onLanguageChange={this.onLanguageChange}
+        />
+        <Bar img="/img/system/community.png" text={dataSource.barText} />
+        <section className="content-section">
+          <Sidemenu dataSource={dataSource.sidemenu} />
+          <div
+            className="doc-content markdown-body"
+            ref={(node) => { this.markdownContainer = node; }}
+            dangerouslySetInnerHTML={{ __html }}
+          />
+        </section>
+        <Footer logo="/img/ds_gray.svg" language={language} />
+      </div>
+    );
+  }
+}
+
+document.getElementById('root') && ReactDOM.render(<Community />, document.getElementById('root'));
+
+export default Community;
diff --git a/src/pages/documentation/index.jsx b/src/pages/documentation/index.jsx
deleted file mode 100755
index 2219522..0000000
--- a/src/pages/documentation/index.jsx
+++ /dev/null
@@ -1,146 +0,0 @@
-import React from 'react';
-import ReactDOM from 'react-dom';
-import { scroller } from 'react-scroll';
-import 'whatwg-fetch'; // fetch polyfill
-import path from 'path';
-import Language from '../../components/language';
-import Header from '../../components/header';
-import Bar from '../../components/bar';
-import Sidemenu from '../../components/sidemenu';
-import Footer from '../../components/footer';
-import docsConfig from '../../../site_config/docs';
-import docsConfig1 from '../../../site_config/docs1-2-1';
-import docsConfig2 from '../../../site_config/docs1-3-1';
-import docsConfig3 from '../../../site_config/docs1-3-2';
-import docsConfig4 from '../../../site_config/docs1-3-3';
-import devConfig from '../../../site_config/development';
-import communityConfig from '../../../site_config/community';
-import './index.scss';
-
-
-// 锚点正则
-const anchorReg = /^#[^/]/;
-// 相对地址正则,包括./、../、直接文件夹名称开头、直接文件开头
-const relativeReg = /^((\.{1,2}\/)|([\w-]+[/.]))/;
-
-class Documentation extends Language {
-
-  constructor(props) {
-    super(props);
-    this.state = {
-      __html: '',
-    };
-  }
-
-  componentDidMount() {
-    // 通过请求获取生成好的json数据,静态页和json文件在同一个目录下
-    fetch(window.location.pathname.replace(/\.html$/i, '.json'))
-    .then(res => res.json())
-    .then((md) => {
-      this.setState({
-        __html: md && md.__html ? md.__html : '',
-      });
-    });
-    this.markdownContainer.addEventListener('click', (e) => {
-      const isAnchor = e.target.nodeName.toLowerCase() === 'a' && e.target.getAttribute('href') && anchorReg.test(e.target.getAttribute('href'));
-      if (isAnchor) {
-        e.preventDefault();
-        const id = e.target.getAttribute('href').slice(1);
-        scroller.scrollTo(id, {
-          duration: 1000,
-          smooth: 'easeInOutQuint',
-        });
-      }
-    });
-  }
-
-  componentDidUpdate() {
-    this.handleRelativeLink();
-    this.handleRelativeImg();
-  }
-
-  handleRelativeLink() {
-    const language = this.getLanguage();
-    // 获取当前文档所在文件系统中的路径
-    // rootPath/en-us/docs/dir/hello.html => /docs/en-us/dir
-    const splitPart = window.location.pathname.replace(`${window.rootPath}/${language}`, '').split('/').slice(0, -1);
-    const filePath = splitPart.join('/');
-    const alinks = Array.from(this.markdownContainer.querySelectorAll('a'));
-    alinks.forEach((alink) => {
-      const href = alink.getAttribute('href');
-      if (relativeReg.test(href)) {
-        // 文档之间有中英文之分,md的相对地址要转换为对应HTML的地址
-        alink.href = `${path.join(`${window.rootPath}/${language}`, filePath, href.replace(/\.(md|markdown)$/, '.html'))}`;
-      }
-    });
-  }
-
-  handleRelativeImg() {
-    const language = this.getLanguage();
-    // 获取当前文档所在文件系统中的路径
-    // rootPath/en-us/docs/dir/hello.html => /docs/en-us/dir
-    const splitPart = window.location.pathname.replace(`${window.rootPath}/${language}`, '').split('/').slice(0, -1);
-    splitPart.splice(2, 0, language);
-    const filePath = splitPart.join('/');
-    const imgs = Array.from(this.markdownContainer.querySelectorAll('img'));
-    imgs.forEach((img) => {
-      const src = img.getAttribute('src');
-      if (relativeReg.test(src)) {
-        // 图片无中英文之分
-        img.src = `${path.join(window.rootPath, filePath, src)}`;
-      }
-    });
-  }
-
-  render() {
-    const language = this.getLanguage();
-    let dataSource = docsConfig1[language];
-    if (window.location.pathname.indexOf('/docs/community/') >= 0) {
-      dataSource = communityConfig[language];
-    }
-    if (window.location.pathname.indexOf('/development/') >= 0) {
-      dataSource = devConfig[language];
-    }
-    if (window.location.pathname.indexOf('/1.3.3/') >= 0) {
-      dataSource = docsConfig4[language];
-    }
-    if (window.location.pathname.indexOf('/1.3.2/') >= 0) {
-      dataSource = docsConfig3[language];
-    }
-    if (window.location.pathname.indexOf('/1.3.1/') >= 0) {
-      dataSource = docsConfig2[language];
-    }
-    if (window.location.pathname.indexOf('/1.2.1/') >= 0) {
-      dataSource = docsConfig1[language];
-    }
-    if (window.location.pathname.indexOf('/1.2.0/') >= 0) {
-      dataSource = docsConfig[language];
-    }
-    const __html = this.props.__html || this.state.__html;
-    return (
-      <div className="documentation-page">
-        <Header
-          currentKey="docs"
-          type="normal"
-          logo="/img/hlogo_colorful.svg"
-          language={language}
-          onLanguageChange={this.onLanguageChange}
-        />
-        <Bar img="/img/system/docs.png" text={dataSource.barText} />
-        <section className="content-section">
-          <Sidemenu dataSource={dataSource.sidemenu} />
-          <div
-            className="doc-content markdown-body"
-            ref={(node) => { this.markdownContainer = node; }}
-            dangerouslySetInnerHTML={{ __html }}
-          />
-        </section>
-        <Footer logo="/img/ds_gray.svg" language={language} />
-      </div>
-    );
-  }
-}
-
-document.getElementById('root') && ReactDOM.render(<Documentation />, document.getElementById('root'));
-
-export default Documentation;
diff --git a/src/pages/documentation/index.md.jsx b/src/pages/documentation/index.md.jsx
new file mode 100755
index 0000000..ecb7d79
--- /dev/null
+++ b/src/pages/documentation/index.md.jsx
@@ -0,0 +1,66 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import Language from '../../components/language';
+import Header from '../../components/header';
+import Footer from '../../components/footer';
+import Md2Html from '../../components/md2html';
+import Bar from '../../components/bar';
+import Sidemenu from '../../components/sidemenu';
+import docsConfig from '../../../site_config/docs';
+import docsConfig1 from '../../../site_config/docs1-2-1';
+import docsConfig2 from '../../../site_config/docs1-3-1';
+import docsConfig3 from '../../../site_config/docs1-3-2';
+import docsConfig4 from '../../../site_config/docs1-3-3';
+import devConfig from '../../../site_config/development';
+
+class Documentation extends Md2Html(Language) {
+
+  render() {
+    const language = this.getLanguage();
+    let dataSource = docsConfig1[language];
+    if (window.location.pathname.indexOf('/development/') >= 0) {
+      dataSource = devConfig[language];
+    }
+    if (window.location.pathname.indexOf('/1.3.3/') >= 0) {
+      dataSource = docsConfig4[language];
+    }
+    if (window.location.pathname.indexOf('/1.3.2/') >= 0) {
+      dataSource = docsConfig3[language];
+    }
+    if (window.location.pathname.indexOf('/1.3.1/') >= 0) {
+      dataSource = docsConfig2[language];
+    }
+    if (window.location.pathname.indexOf('/1.2.1/') >= 0) {
+      dataSource = docsConfig1[language];
+    }
+    if (window.location.pathname.indexOf('/1.2.0/') >= 0) {
+      dataSource = docsConfig[language];
+    }
+    const __html = this.props.__html || this.state.__html;
+    return (
+      <div className="md2html documentation-page">
+        <Header
+          currentKey="docs"
+          type="normal"
+          logo="/img/hlogo_colorful.svg"
+          language={language}
+          onLanguageChange={this.onLanguageChange}
+        />
+        <Bar img="/img/system/docs.png" text={dataSource.barText} />
+        <section className="content-section">
+          <Sidemenu dataSource={dataSource.sidemenu} />
+          <div
+            className="doc-content markdown-body"
+            ref={(node) => { this.markdownContainer = node; }}
+            dangerouslySetInnerHTML={{ __html }}
+          />
+        </section>
+        <Footer logo="/img/ds_gray.svg" language={language} />
+      </div>
+    );
+  }
+}
+
+document.getElementById('root') && ReactDOM.render(<Documentation />, document.getElementById('root'));
+
+export default Documentation;
diff --git a/template.ejs b/template.ejs
index e5e6946..15e2353 100755
--- a/template.ejs
+++ b/template.ejs
@@ -15,9 +15,16 @@
 	<div id="root"><%- __html %></div>
 	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
 	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
-	<script>
-		window.rootPath = '<%= rootPath %>';
-  </script>
+	<script>window.rootPath = '<%= rootPath %>';</script>
 	<script src="<%= rootPath %>/build/<%= page %>.js"></script>
+	<script>
+	  var _hmt = _hmt || [];
+	  (function() {
+		var hm = document.createElement("script");
+		hm.src = "https://hm.baidu.com/hm.js?4e7b4b400dd31fa015018a435c64d06f";
+		var s = document.getElementsByTagName("script")[0];
+		s.parentNode.insertBefore(hm, s);
+	  })();
+	</script>
 </body>
 </html>
\ No newline at end of file
diff --git a/webpack.config.js b/webpack.config.js
index 3ac6c98..ef22cbf 100755
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -6,11 +6,24 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
 const entry = {};
 const targetPath = path.join(__dirname, './src/pages');
 fs.readdirSync(targetPath).forEach(page => {
-  if (
-    fs.statSync(path.join(targetPath, page)).isDirectory() &&
-    fs.existsSync(path.join(targetPath, page, 'index.jsx'))
-  ) {
-    entry[page] = path.join(targetPath, page, 'index.jsx');
+  const entries = [];
+  const pagePath = path.join(targetPath, page);
+  if (fs.statSync(pagePath).isDirectory()) {
+    if (fs.existsSync(path.join(pagePath, 'index.jsx'))) {
+      entries.push(path.join(pagePath, 'index.jsx'));
+    }
+    if (fs.existsSync(path.join(pagePath, 'index.md.jsx'))) {
+      entry[page+'.md'] = path.join(pagePath, 'index.md.jsx');
+    }
+    fs.readdirSync(pagePath).forEach(subPage => {
+      const subPagePath = path.join(pagePath, subPage);
+      if (fs.existsSync(path.join(subPagePath, 'index.jsx'))) {
+        entries.push(path.join(subPagePath, 'index.jsx'));
+      }
+    });
+    if (entries.length) {
+      entry[page] = entries;
+    }
   }
 });
 module.exports = {