You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.2 KiB

5 months ago
  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/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></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/codemirror5">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. {{{propertyContainingRawHtml}}}
  37. {{#each articles}}
  38. {{~title}}
  39. <p>{{excerpt body size=120 ellipsis=true}}</p>
  40. {{#with author}}
  41. written by {{first_name}} {{last_name}}
  42. from category: {{../category.title}}
  43. {{#if @../last}}foobar!{{/if}}
  44. {{/with~}}
  45. {{#if promoted.latest}}Read this one! {{else}} This is ok! {{/if}}
  46. {{#if @last}}<hr>{{/if}}
  47. {{/each}}
  48. {{#form new_comment}}
  49. <input type="text" name="body">
  50. {{/form}}
  51. </textarea></form>
  52. <script>
  53. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  54. lineNumbers: true,
  55. matchBrackets: true,
  56. mode: {name: "handlebars", base: "text/html"}
  57. });
  58. </script>
  59. <p>Handlebars syntax highlighting for CodeMirror.</p>
  60. <p><strong>MIME types defined:</strong> <code>text/x-handlebars-template</code></p>
  61. <p>Supported options: <code>base</code> to set the mode to
  62. wrap. For example, use</p>
  63. <pre>mode: {name: "handlebars", base: "text/html"}</pre>
  64. <p>to highlight an HTML template.</p>
  65. </article>