File tree Expand file tree Collapse file tree 5 files changed +21
-6
lines changed Expand file tree Collapse file tree 5 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ port = 3306
23
23
user = root
24
24
password =
25
25
dbname = studygolang
26
- charset = utf8
26
+ charset = utf8mb4
27
27
28
28
; 最大空闲连接数
29
29
max_idle = 2
Original file line number Diff line number Diff line change @@ -78,8 +78,22 @@ SG.replaceSpecialChar = function(str) {
78
78
}
79
79
80
80
SG . markSetting = function ( ) {
81
- // 配置 marked 语法高亮
81
+ var renderer = new marked . Renderer ( ) ;
82
+
83
+ // 对 html 进行处理
84
+ renderer . html = function ( html ) {
85
+ if ( html . indexOf ( '<video' ) == 0 ) {
86
+ return html ;
87
+ } else if ( html . indexOf ( '<table' ) == 0 ) {
88
+ return html ;
89
+ } else {
90
+ return html . replace ( / < / g, '<' ) ;
91
+ }
92
+ } ;
93
+
82
94
marked . setOptions ( {
95
+ renderer : renderer ,
96
+ // 配置 marked 语法高亮
83
97
highlight : function ( code ) {
84
98
code = SG . replaceSpecialChar ( code ) ;
85
99
return hljs . highlightAuto ( code ) . value ;
Original file line number Diff line number Diff line change 16
16
SG . Topics = function ( ) { }
17
17
SG . Topics . prototype = new SG . Publisher ( ) ;
18
18
SG . Topics . prototype . parseContent = function ( selector ) {
19
- var markdownString = SG . preProcess ( selector . text ( ) ) ;
19
+ var markdownString = selector . text ( ) ;
20
20
// 配置 marked 语法高亮
21
21
marked = SG . markSetting ( ) ;
22
22
23
23
var contentHtml = marked ( markdownString ) ;
24
24
contentHtml = SG . replaceCodeChar ( contentHtml ) ;
25
+
25
26
selector . html ( contentHtml ) ;
26
27
27
28
// emoji 表情解析
Original file line number Diff line number Diff line change 253
253
}
254
254
var GLaunchTime = { { timestamp . app . LaunchTime } } * 1000 ;
255
255
</ script >
256
- < script src ="/static/js/common.js?v=1.4 "> </ script >
256
+ < script src ="/static/js/common.js?v=1.0 "> </ script >
257
257
{{template "js" .}}
258
258
< script type ="text/javascript " src ="//cdnjs.cloudflare.com/ajax/libs/jsrender/0.9.84/jsrender.min.js "> </ script >
259
259
< script type ="text/javascript ">
Original file line number Diff line number Diff line change 34
34
< div class ="outdated "> 这是一个创建于 < span title ="{{.topic.ctime}} " class ="timeago "> </ span > 的主题,其中的信息可能已经有所发展或是发生改变。</ div >
35
35
{{end}}
36
36
< div class ="cell ">
37
- < div class ="content "> {{.topic.content | html }}</ div >
37
+ < div class ="content "> {{.topic.content}}</ div >
38
38
</ div >
39
39
40
40
< div class ="content-buttons ">
125
125
< script type ="text/javascript " src ="/static/js/libs/emojify.min.js "> </ script >
126
126
< script type ="text/javascript " src ="/static/js/libs/emojis.js "> </ script >
127
127
< script type ="text/javascript " src ="/static/js/libs/plupload.full.min.js "> </ script >
128
- < script type ="text/javascript " src ="/static/js/topics.js?v=1.2 "> </ script >
128
+ < script type ="text/javascript " src ="/static/js/topics.js?v=1.1 "> </ script >
129
129
< script type ="text/javascript " src ="/static/js/comment.js?v=1.23 "> </ script >
130
130
< script type ="text/javascript " src ="/static/js/puploader.js?v=1.2 "> </ script >
131
131
< script type ="text/javascript ">
You can’t perform that action at this time.
0 commit comments