Skip to content

Commit c582a1c

Browse files
committed
release 2.0.0
1 parent 8ff43b1 commit c582a1c

12 files changed

+728
-333
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- 2018-12-08 增加 MathJax 支持(附 [一个生成 LaTex 公式的网站](https://webdemo.myscript.com/views/math/index.html)
2+
- 2018-12-16 修改 api,release 2.0.0

README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66

77
我们可以比较下原始的 markdown 文件和用 codedog 二次生成后的文件:
88

9-
- [原始的 markdown 文件](https://raw.githubusercontent.com/hanzichi/codedog/master/example/index.md)[效果](https://github.com/hanzichi/codedog/blob/master/example/index.md)
10-
- [codedog 二次生成后的 html 文件](https://github.com/hanzichi/codedog/blob/master/example/index.html)[效果](https://hanzichi.github.io/codedog/example/index.html)
9+
- [原始的 markdown 文件](https://raw.githubusercontent.com/hanzichi/codedog/master/example/example.md)[效果](https://github.com/hanzichi/codedog/blob/master/example/example.md)
10+
- [codedog 二次生成后的 html 文件](https://github.com/hanzichi/codedog/blob/master/example/example.html)[效果](https://hanzichi.github.io/codedog/example/example.html)
1111

1212
另外,这个项目是我为 [css-secrets](https://github.com/hanzichi/css-secrets) 特意创造的,更多应用可以点 [这里](https://github.com/hanzichi/css-secrets/blob/master/README.md) 查看
1313

1414
## 用法
1515

16-
因为纯属个人工具,没有很大的应用需求,故不再在 [npmjs](https://www.npmjs.com/package/codedog) 更新
17-
1816
该项目使用非常简单,支持模块引用和全局引用,个人推荐全局引用方式
1917

2018
### 本地安装
@@ -50,15 +48,16 @@ npm install
5048
gulp
5149
```
5250

53-
接下去在 `lib``example` 两个文件夹中修改文件,codedog 会自动编译 index.md 文件,生成新的 index.html 文件并且自动刷新打开的页面
51+
接下去在 `lib``example` 两个文件夹中修改文件,codedog 会自动编译 example.md 文件,生成新的 example.html 文件并且自动刷新打开的页面
5452

5553
## 注意事项
5654

5755
- 该项目用于从 markdown 生成 html,并提供某些在线编辑/预览,如果没有这个需求,说明你不需要
5856
- **markdown 中标注为 `html` 的代码块会被 codedog 解析**,并生成在线 demo,其余代码块不会解析
5957
- 被解析的代码块,支持内联 css 和 js,支持绝对路径的外链 css 和 js
6058
- 点击新页面打开,会在新的页面打开在线 demo
61-
- 页面 title 默认为第一次出现的 `# xxx` 中的 `xxx`,且 markdown 文件中一级标题只允许出现一次,且默认 `# xxx` 肯定早于其他二级标题、三级标题等出现
59+
- 页面 title 默认为第一次出现的一级标题,且 markdown 文件中一级标题只允许出现一次,且默认一级标题肯定早于其他二级标题、三级标题等出现
60+
- 不支持移动端,个人觉得移动端上编辑代码&预览效果不方便,故不提供支持
6261

6362
## lisence
6463

bin/cli.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#!/usr/bin/env node
2-
32
const fs = require('fs')
4-
const codedog = require('../lib/index.js')
3+
const codedog = require('../lib')
54

65
let filePath = process.argv[2]
76
let outPath = filePath.replace('md', 'html')
87

9-
let editorWidth = ~~process.argv[3] // default to 100% width
10-
let editorHeight = ~~process.argv[4] || 270 // default to 270px as the height
8+
let editorWidth = ~~process.argv[3] // default is 100% width
9+
let editorHeight = ~~process.argv[4] || 270 // default is 270px as the height
1110

1211
let mdString = fs.readFileSync(filePath, 'utf-8')
13-
let html = codedog.markdown2html(mdString, editorWidth, editorHeight)
12+
let html = codedog(mdString, editorWidth, editorHeight)
1413
fs.writeFileSync(outPath, html)

0 commit comments

Comments
 (0)