OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> |
| 10 |
| 11 <link rel="import" href="../../polymer/polymer.html"> |
| 12 <link rel="import" href="../../prism-element/prism-highlighter.html"> |
| 13 <link rel="import" href="../../marked-element/marked-element.html"> |
| 14 |
| 15 <!-- |
| 16 Quick element that can display the source of a code snippet and a rendered demo. |
| 17 |
| 18 <demo-snippet> |
| 19 <template> |
| 20 <style is="custom-style"> |
| 21 #demo6 { |
| 22 @apply(--layout-horizontal); |
| 23 @apply(--layout-start); |
| 24 height: 120px; |
| 25 } |
| 26 </style> |
| 27 |
| 28 <div class="container" id="demo6"> |
| 29 <div>start</div> |
| 30 </div> |
| 31 </template> |
| 32 </demo-snippet> |
| 33 --> |
| 34 |
| 35 <dom-module id="demo-snippet"> |
| 36 <template> |
| 37 <style> |
| 38 :host { |
| 39 display:inline-block; |
| 40 } |
| 41 |
| 42 .demo { |
| 43 border-bottom: 1px solid #e5e5e5; |
| 44 margin: 0; |
| 45 } |
| 46 |
| 47 .code { |
| 48 padding: 0; |
| 49 margin: 0; |
| 50 background-color: #fafafa; |
| 51 font-size: 13px; |
| 52 word-wrap: break-word; |
| 53 } |
| 54 |
| 55 .code > pre { |
| 56 margin: 0; |
| 57 padding: 0 0 10px 0; |
| 58 } |
| 59 </style> |
| 60 |
| 61 <prism-highlighter></prism-highlighter> |
| 62 |
| 63 <div class="demo"> |
| 64 <content id="content"></content> |
| 65 </div> |
| 66 |
| 67 <marked-element markdown=[[_markdown]]> |
| 68 <div class="markdown-html code"></div> |
| 69 </marked-element> |
| 70 </template> |
| 71 |
| 72 <script> |
| 73 Polymer({ |
| 74 is: 'demo-snippet', |
| 75 |
| 76 properties: { |
| 77 _markdown: { |
| 78 type: String, |
| 79 value: '' |
| 80 } |
| 81 }, |
| 82 |
| 83 attached: function() { |
| 84 var template = Polymer.dom(this).queryDistributedElements('template')[0]
; |
| 85 |
| 86 var snippet = Polymer.domInnerHTML.getInnerHTML(template); |
| 87 this._markdown = '```\n' + snippet + '\n' + '```'; |
| 88 |
| 89 // Stamp the template. |
| 90 Polymer.dom(this).appendChild(document.importNode(template.content, true
)); |
| 91 } |
| 92 }); |
| 93 </script> |
| 94 |
| 95 </dom-module> |
OLD | NEW |