diff --git a/.eslintrc.json b/.eslintrc.json index 3d060adf..e492fc3d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -13,6 +13,5 @@ "indent": ["off", 2], "comma-dangle": ["error", "never"], "no-console": ["off"] - } } \ No newline at end of file diff --git a/_site/documents/config.html b/_site/documents/config.html index 6aec5c31..e29aa9a2 100644 --- a/_site/documents/config.html +++ b/_site/documents/config.html @@ -1,4 +1,4 @@ -
在 docs 目录下,新建 _components 文件夹,创建 Icon.jsx 文件,复制以下源码,可将系统默认的 icon 替换成 docs/ydoc.ico
-<link rel="shortcut icon" href={relePath(props.distPath, 'ydoc.ico')} />
+在 docs 目录下,新建 _components 文件夹,创建 Icon.jsx 文件,复制以下源码,可将系统默认的 icon 替换成 docs/images/xxx
+<link rel="apple-touch-icon" sizes="180x180" href={relePath(props.distPath, 'images/apple-touch-icon.png')} />
+<link rel="icon" type="image/png" sizes="32x32" href={relePath(props.distPath, 'images/favicon-32x32.png')} />
+<link rel="icon" type="image/png" sizes="16x16" href={relePath(props.distPath, 'images/favicon-16x16.png')} />
+<link rel="manifest" href={relePath(props.distPath, 'images/manifest.json')} />
+<link rel="mask-icon" href={relePath(props.distPath, 'images/safari-pinned-tab.svg')} color="#5bbad5" />
引入js 和css
配置如下:
diff --git a/_site/documents/release.html b/_site/documents/release.html
index 5e838a43..2e8ca37e 100644
--- a/_site/documents/release.html
+++ b/_site/documents/release.html
@@ -1,4 +1,4 @@
-文档
+文档
diff --git a/_site/documents/structure.html b/_site/documents/structure.html
index 767d6561..3272f2a0 100644
--- a/_site/documents/structure.html
+++ b/_site/documents/structure.html
@@ -1,4 +1,4 @@
-目录结构-文档
+目录结构-文档
diff --git a/_site/documents/theme.html b/_site/documents/theme.html
index b824f051..44d6b54a 100644
--- a/_site/documents/theme.html
+++ b/_site/documents/theme.html
@@ -1,4 +1,4 @@
-主题-文档
+主题-文档
diff --git a/_site/index.html b/_site/index.html
index 2ebbee5d..c13f5c3d 100644
--- a/_site/index.html
+++ b/_site/index.html
@@ -1,4 +1,4 @@
-ydoc
+ydoc
diff --git a/_site/plugin/index.html b/_site/plugin/index.html
index 8e98ffca..74ca0872 100644
--- a/_site/plugin/index.html
+++ b/_site/plugin/index.html
@@ -1,4 +1,4 @@
-插件
+插件
diff --git a/_site/search_json.js b/_site/search_json.js
index c5bf0dd3..9bd322d7 100644
--- a/_site/search_json.js
+++ b/_site/search_json.js
@@ -360,7 +360,7 @@ window.ydoc_plugin_search_json = {
{
"title": "icon",
"url": "/documents/qa.html#icon",
- "content": "icon在 docs 目录下,新建 _components 文件夹,创建 Icon.jsx 文件,复制以下源码,可将系统默认的 icon 替换成 docs/ydoc.ico"
+ "content": "icon在 docs 目录下,新建 _components 文件夹,创建 Icon.jsx 文件,复制以下源码,可将系统默认的 icon 替换成 docs/images/xxx\n\n\n\n"
},
{
"title": "引入js 和css",
diff --git a/_site/standard/index.html b/_site/standard/index.html
index 792d2344..224734da 100644
--- a/_site/standard/index.html
+++ b/_site/standard/index.html
@@ -1,4 +1,4 @@
-文档体系-设计规范
+文档体系-设计规范
diff --git a/_site/standard/style-guide.html b/_site/standard/style-guide.html
index 0d572dce..69960b60 100644
--- a/_site/standard/style-guide.html
+++ b/_site/standard/style-guide.html
@@ -1,4 +1,4 @@
-设计规范
+设计规范
diff --git a/docs/documents/qa.md b/docs/documents/qa.md
index 9aa1930e..8e317dea 100644
--- a/docs/documents/qa.md
+++ b/docs/documents/qa.md
@@ -3,12 +3,12 @@
### icon
在 docs 目录下,新建 _components 文件夹,创建 Icon.jsx 文件,复制以下源码,可将系统默认的 icon 替换成 docs/images/xxx
-```html
+```jsx
-
+
```
### 引入js 和css
diff --git a/src/commands/build.js b/src/commands/build.js
index 3e8da13f..e67f56e7 100644
--- a/src/commands/build.js
+++ b/src/commands/build.js
@@ -1,7 +1,6 @@
-
-const logger = require('../logger')
-const utils = require('../utils')
-const runner = require('../index')
+const logger = require('../logger');
+const utils = require('../utils');
+const runner = require('../index');
module.exports = {
setOptions: function (yargs) {
diff --git a/src/commands/init.js b/src/commands/init.js
index 49c73c38..0b23eb7e 100644
--- a/src/commands/init.js
+++ b/src/commands/init.js
@@ -3,15 +3,15 @@ const fs = require('fs-extra');
const projectPath = process.cwd();
const utils = require('../utils');
const initPath = path.resolve(__dirname, '../init');
-const docsPath = path.resolve(projectPath, 'docs')
+const docsPath = path.resolve(projectPath, 'docs');
module.exports = {
setOptions: function () {},
run: function () {
let configFilepath = utils.getConfigPath(projectPath);
- if(configFilepath){
+ if (configFilepath) {
return utils.log.error('The current directory already exists ydoc config.')
- }else if(utils.dirExist(docsPath)){
+ }else if (utils.dirExist(docsPath)) {
return utils.log.error('The current directory already exists directory "docs".');
}
fs.ensureDirSync(docsPath);
diff --git a/src/commands/serve.js b/src/commands/serve.js
index 336f96c3..274838d2 100644
--- a/src/commands/serve.js
+++ b/src/commands/serve.js
@@ -1,7 +1,7 @@
const chokidar = require('chokidar');
-const path = require('path')
+const path = require('path');
const child_process = require('child_process');
-const utils = require('../utils')
+const utils = require('../utils');
const ora = require('ora');
let port = 9999;
diff --git a/src/logger.js b/src/logger.js
index a25d8d04..5fb1a115 100644
--- a/src/logger.js
+++ b/src/logger.js
@@ -1,7 +1,6 @@
const util = require('util');
const color = require('bash-color');
-
const LEVELS = {
DEBUG: 0,
INFO: 1,
diff --git a/src/parse/markdown.js b/src/parse/markdown.js
index 0a1c5138..4e2b0b4a 100644
--- a/src/parse/markdown.js
+++ b/src/parse/markdown.js
@@ -8,18 +8,18 @@ utils.md = MarkdownIt({
html: true,
linkify: false,
highlight: function (str, lang) {
- // js => javascript
- if (lang.toLowerCase() === 'js') {
- lang = 'javascript';
- }
try {
if (lang) {
+ // js => javascript
+ if (lang.toLowerCase() === 'js') {
+ lang = 'javascript';
+ }
// html 的高亮使用 haml 语法
if (lang.toLocaleLowerCase() === 'html') {
lang = 'haml';
}
loadLanguages([lang]);
- return Prism.highlight(str, Prism.languages[lang], lang);
+ return prism.highlight(str, prism.languages[lang], lang);
}
return he.encode(str);
} catch (err) {
diff --git a/src/utils.js b/src/utils.js
index 4696ecba..bbbd58d1 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -142,5 +142,4 @@ function mergeCopyFiles(src, dist){
})
}
-exports.mergeCopyFiles = mergeCopyFiles
-
+exports.mergeCopyFiles = mergeCopyFiles;
\ No newline at end of file
diff --git a/src/ydoc.js b/src/ydoc.js
index 6c5950d5..5b33c3b7 100644
--- a/src/ydoc.js
+++ b/src/ydoc.js
@@ -5,7 +5,7 @@ const projectPath = utils.projectPath;
const assets = {
js: [],
css: []
-}
+};
const ydoc = {
@@ -19,15 +19,15 @@ const ydoc = {
author: "ymfe",
theme: 'default'
},
- hook: function(name){
+ hook: function(name) {
const {emitTplHook} = require('./plugin.js')
let args = Array.prototype.slice.call(arguments, 1);
args.unshift(utils.defaultTplHookPrefix + name)
let tpls = emitTplHook.apply(this, args)
return tpls.join("\n")
},
- relePath: function(srcFilepath, importFilepath){
- if(utils.isUrl(importFilepath)){
+ relePath: function(srcFilepath, importFilepath) {
+ if (utils.isUrl(importFilepath)) {
return importFilepath;
}
importFilepath = path.isAbsolute(importFilepath)? importFilepath : path.resolve(ydoc.config.dist, importFilepath);
@@ -35,14 +35,14 @@ const ydoc = {
let rele = path.relative(srcFilepath, importFilepath);
return rele.substr(3);
},
- addAsset: function(filepath, type){
- if(type === 'js'){
+ addAsset: function(filepath, type) {
+ if (type === 'js') {
assets.js.push(filepath);
- }else if(type === 'css'){
+ }else if (type === 'css') {
assets.css.push(filepath);
}
},
- getAssets: function(type){
+ getAssets: function(type) {
return type ? [].concat(assets[type]) : {
js: [].concat(assets.js),
css: [].concat(assets.css)
@@ -52,6 +52,6 @@ const ydoc = {
-module.exports=ydoc;
+module.exports = ydoc;
diff --git a/theme/build.js b/theme/build.js
index e96dd370..064bde2c 100644
--- a/theme/build.js
+++ b/theme/build.js
@@ -12,9 +12,7 @@ const styleOutPath = path.resolve(__dirname, './style.css')
* node build.js watch # build style.css with watch file changes
*/
-
// 编译 scss 文件至 docs 目录中
-
function build(){
sass.render({
file: styleInPath,
@@ -26,7 +24,7 @@ function build(){
if (err) {
throw err;
}
- console.log('Generate style.css success.')
+ console.log('Generate style.css success!')
})
} else {
throw err;
@@ -34,11 +32,11 @@ function build(){
})
}
-build()
+build();
-if(process.argv[2] === 'watch'){
+if (process.argv[2] === 'watch') {
chokidar.watch(styleInDir, {
ignoreInitial: true
- }).on('all', build)
+ }).on('all', build);
}
diff --git a/theme/components/Icon.jsx b/theme/components/Icon.jsx
index 9ea82619..a05675f9 100644
--- a/theme/components/Icon.jsx
+++ b/theme/components/Icon.jsx
@@ -2,4 +2,4 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/theme/components/Scripts.jsx b/theme/components/Scripts.jsx
index ff611bde..b39d0ba8 100644
--- a/theme/components/Scripts.jsx
+++ b/theme/components/Scripts.jsx
@@ -1,5 +1,3 @@
-
-
{
(()=>{
var script = `