Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 3e133fb

Browse files
author
Scott J. Miles
committed
remove white-space stripping that was confusing the doc viewer (does it regress something else?)
1 parent 14b6f6a commit 3e133fb

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

demo.html

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html>
22
<!--
33
Copyright 2013 The Polymer Authors. All rights reserved.
44
Use of this source code is governed by a BSD-style
@@ -11,14 +11,27 @@
1111
<script src="../platform/platform.js"></script>
1212
<link rel="import" href="marked-js.html">
1313
</head>
14-
<body>
14+
<body unresolved>
1515
<marked-js>
1616
## Markdown Renderer
1717

1818
* implemented in `JavaScript`
1919
* realtime formatting
2020

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+
2131
_Nifty_ features.
2232
</marked-js>
33+
34+
<marked-js text=" <div>div</div>"></marked-js>
35+
2336
</body>
2437
</html>

marked-js.html

+10-4
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,32 @@
77
<script src="marked/marked.js"></script>
88

99
<polymer-element name="marked-js" attributes="text">
10+
1011
<script>
1112
Polymer('marked-js', {
13+
1214
text: '',
13-
allowAuthorStyles: true,
14-
enteredView: function() {
1515

16+
enteredView: function() {
1617
marked.setOptions({
1718
highlight: this.highlight.bind(this)
1819
});
1920
if (!this.text) {
2021
this.text = this.innerHTML;
2122
}
2223
},
24+
2325
textChanged: function () {
24-
this.innerHTML = marked(this.text.replace(/^[^\S\n]+/gm,''));
26+
this.innerHTML = marked(this.text);
2527
},
28+
2629
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;
2832
}
33+
2934
});
3035
</script>
36+
3137
</polymer-element>
3238

0 commit comments

Comments
 (0)