This repository was archived by the owner on Mar 13, 2018. It is now read-only.
File tree 2 files changed +25
-6
lines changed
2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 1
- <!DOCTYPE html>
1
+ <!DOCTYPE html>
2
2
<!--
3
3
Copyright 2013 The Polymer Authors. All rights reserved.
4
4
Use of this source code is governed by a BSD-style
11
11
< script src ="../platform/platform.js "> </ script >
12
12
< link rel ="import " href ="marked-js.html ">
13
13
</ head >
14
- < body >
14
+ < body unresolved >
15
15
< marked-js >
16
16
## Markdown Renderer
17
17
18
18
* implemented in `JavaScript`
19
19
* realtime formatting
20
20
21
+ Example:
22
+
23
+ < div >
24
+ < polymer-overlay > </ polymer-overlay >
25
+ < h2 > Dialog</ h2 >
26
+ < input placeholder ="say something... " autofocus >
27
+ < div > I agree with this wholeheartedly.</ div >
28
+ < button overlay-toggle > OK</ button >
29
+ </ div >
30
+
21
31
_Nifty_ features.
22
32
</ marked-js >
33
+
34
+ < marked-js text =" <div>div</div> "> </ marked-js >
35
+
23
36
</ body >
24
37
</ html >
Original file line number Diff line number Diff line change 7
7
< script src ="marked/marked.js "> </ script >
8
8
9
9
< polymer-element name ="marked-js " attributes ="text ">
10
+
10
11
< script >
11
12
Polymer ( 'marked-js' , {
13
+
12
14
text : '' ,
13
- allowAuthorStyles : true ,
14
- enteredView : function ( ) {
15
15
16
+ enteredView : function ( ) {
16
17
marked . setOptions ( {
17
18
highlight : this . highlight . bind ( this )
18
19
} ) ;
19
20
if ( ! this . text ) {
20
21
this . text = this . innerHTML ;
21
22
}
22
23
} ,
24
+
23
25
textChanged : function ( ) {
24
- this . innerHTML = marked ( this . text . replace ( / ^ [ ^ \S \n ] + / gm , '' ) ) ;
26
+ this . innerHTML = marked ( this . text ) ;
25
27
} ,
28
+
26
29
highlight : function ( code , lang ) {
27
- return this . fire ( 'marked-js-highlight' , { code : code , lang : lang } ) . code || code ;
30
+ var event = this . fire ( 'marked-js-highlight' , { code : code , lang : lang } ) ;
31
+ return event . detail . code || code ;
28
32
}
33
+
29
34
} ) ;
30
35
</ script >
36
+
31
37
</ polymer-element >
32
38
You can’t perform that action at this time.
0 commit comments