index.html 2.2 KB

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