scripts/CodeMirror/mode/handlebars/index.html (view raw)
1<!doctype html>
2
3<title>CodeMirror: Handlebars mode</title>
4<meta charset="utf-8"/>
5<link rel=stylesheet href="../../doc/docs.css">
6
7<link rel="stylesheet" href="../../lib/codemirror.css">
8<script src="../../lib/codemirror.js"></script>
9<script src="../../addon/mode/simple.js"></script>
10<script src="../../addon/mode/multiplex.js"></script>
11<script src="../../addon/edit/matchbrackets.js"></script>
12<script src="../xml/xml.js"></script>
13<script src="handlebars.js"></script>
14<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
15<div id=nav>
16 <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
17
18 <ul>
19 <li><a href="../../index.html">Home</a>
20 <li><a href="../../doc/manual.html">Manual</a>
21 <li><a href="https://github.com/codemirror/codemirror">Code</a>
22 </ul>
23 <ul>
24 <li><a href="../index.html">Language modes</a>
25 <li><a class=active href="#">HTML mixed</a>
26 </ul>
27</div>
28
29<article>
30<h2>Handlebars</h2>
31<form><textarea id="code" name="code">
32{{> breadcrumbs}}
33
34{{!--
35 You can use the t function to get
36 content translated to the current locale, es:
37 {{t 'article_list'}}
38--}}
39
40<h1>{{t 'article_list'}}</h1>
41
42{{! one line comment }}
43
44{{{propertyContainingRawHtml}}}
45
46{{#each articles}}
47 {{~title}}
48 <p>{{excerpt body size=120 ellipsis=true}}</p>
49
50 {{#with author}}
51 written by {{first_name}} {{last_name}}
52 from category: {{../category.title}}
53 {{#if @../last}}foobar!{{/if}}
54 {{/with~}}
55
56 {{#if promoted.latest}}Read this one! {{else}} This is ok! {{/if}}
57
58 {{#if @last}}<hr>{{/if}}
59{{/each}}
60
61{{#form new_comment}}
62 <input type="text" name="body">
63{{/form}}
64
65</textarea></form>
66 <script>
67 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
68 lineNumbers: true,
69 matchBrackets: true,
70 mode: {name: "handlebars", base: "text/html"}
71 });
72 </script>
73
74 <p>Handlebars syntax highlighting for CodeMirror.</p>
75
76 <p><strong>MIME types defined:</strong> <code>text/x-handlebars-template</code></p>
77
78 <p>Supported options: <code>base</code> to set the mode to
79 wrap. For example, use</p>
80 <pre>mode: {name: "handlebars", base: "text/html"}</pre>
81 <p>to highlight an HTML template.</p>
82</article>