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

Commit

Permalink
add boilerplate documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott J. Miles committed Apr 29, 2014
1 parent 3e4487d commit 761922b
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions marked-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,41 @@
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="marked-import.html">

<polymer-element name="marked-element" attributes="text">

<script>

Polymer('marked-element', {
<!--
Element wrapper for the `marked` (http://marked.org/) library.
text: '',
@class marked-element
@blurb Element wrapper for the marked library.
@status alpha
@snap snap.png
-->
<polymer-element name="marked-element" attributes="text">
<script>

enteredView: function() {
marked.setOptions({
highlight: this.highlight.bind(this)
});
if (!this.text) {
this.text = this.innerHTML;
}
},
Polymer('marked-element', {

textChanged: function () {
this.innerHTML = marked(this.text);
},
text: '',

highlight: function(code, lang) {
var event = this.fire('marked-js-highlight', {code: code, lang: lang});
return event.detail.code || code;
attached: function() {
marked.setOptions({
highlight: this.highlight.bind(this)
});
if (!this.text) {
this.text = this.innerHTML;
}
},

textChanged: function () {
this.innerHTML = marked(this.text);
},

});
highlight: function(code, lang) {
var event = this.fire('marked-js-highlight', {code: code, lang: lang});
return event.detail.code || code;
}

</script>
});

</script>
</polymer-element>

0 comments on commit 761922b

Please sign in to comment.