Skip to content

Commit

Permalink
完成 1.0.2 版本目标
Browse files Browse the repository at this point in the history
  • Loading branch information
fy0 committed Sep 9, 2017
1 parent 457a5ea commit 24e6f90
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
2 changes: 2 additions & 0 deletions page/src/components/topic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ export default {
if (ret.code == 0) {
this.user_comment_text = '';
this.commentFetch(this.comments_page);
} else {
$.message_error(ret.msg);
}
}
},
Expand Down
31 changes: 29 additions & 2 deletions page/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ new Vue({
// markdown 渲染和代码高亮
import marked from 'marked'
import Prism from 'prismjs'
import "prismjs/themes/prism.css"
// import "prismjs/themes/prism-okaidia.css" ..备选1
import "prismjs/themes/prism-tomorrow.css" //备选2
// import './assets/css/prism-atom-dark.css'
// prism 默认包含高亮:
// ["extend", "insertBefore", "DFS", "markup", "xml", "html", "mathml", "svg", "css", "clike", "javascript", "js"]
import 'prismjs/components/prism-autohotkey.js'
Expand All @@ -132,11 +134,36 @@ import 'prismjs/components/prism-lua.js'
import 'prismjs/components/prism-markdown.js'
import 'prismjs/components/prism-python.js'
import 'prismjs/components/prism-sql.js'
import 'prismjs/components/prism-nginx.js'

let renderer = new marked.Renderer();

renderer.code = function(code, lang, escaped) {
if (this.options.highlight) {
var out = this.options.highlight(code, lang);
if (out != null && out !== code) {
escaped = true;
code = out;
}
}

if (!lang) {
return `<pre><code class="${this.options.langPrefix}-markup">`
+ (escaped ? code : escape(code, true))
+ '\n</code></pre>';
}

let langText = this.options.langPrefix + escape(lang, true);
return `<pre class="${langText}"><code class="${langText}">`
+ (escaped ? code : escape(code, true))
+ '\n</code></pre>\n';
};


marked.setOptions({
renderer: new marked.Renderer(),
renderer: renderer,
sanitize: true,
langPrefix: 'language-',
highlight: function (code, lang) {
if (lang) {
let stdlang = lang.toLowerCase();
Expand Down
6 changes: 5 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## 版本历史

### ver 1.0.2 wip
### ver 1.0.2 update 2017.09.09

* 加入通用分页器

Expand All @@ -15,6 +15,10 @@

* 修正了低权限用户左侧边栏上仍有撰文和管理导航的问题

* 修正了代码引用不显示背景的问题

* 修正了评论因某些原因发送失败时不弹提示的问题

* 优化:编辑器按需加载,体积减小1/3


Expand Down
1 change: 0 additions & 1 deletion todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
* ~~fpage app.py 全端口开放问题~~
* 非注册评论
* 引用文章功能
* 百度统计

0 comments on commit 24e6f90

Please sign in to comment.