index.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!doctype html>
  2. <title>CodeMirror: ProtoBuf 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="protobuf.js"></script>
  8. <style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
  9. <div id=nav>
  10. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  11. <ul>
  12. <li><a href="../../index.html">Home</a>
  13. <li><a href="../../doc/manual.html">Manual</a>
  14. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  15. </ul>
  16. <ul>
  17. <li><a href="../index.html">Language modes</a>
  18. <li><a class=active href="#">ProtoBuf</a>
  19. </ul>
  20. </div>
  21. <article>
  22. <h2>ProtoBuf mode</h2>
  23. <form><textarea id="code" name="code">
  24. package addressbook;
  25. message Address {
  26. required string street = 1;
  27. required string postCode = 2;
  28. }
  29. message PhoneNumber {
  30. required string number = 1;
  31. }
  32. message Person {
  33. optional int32 id = 1;
  34. required string name = 2;
  35. required string surname = 3;
  36. optional Address address = 4;
  37. repeated PhoneNumber phoneNumbers = 5;
  38. optional uint32 age = 6;
  39. repeated uint32 favouriteNumbers = 7;
  40. optional string license = 8;
  41. enum Gender {
  42. MALE = 0;
  43. FEMALE = 1;
  44. }
  45. optional Gender gender = 9;
  46. optional fixed64 lastUpdate = 10;
  47. required bool deleted = 11 [default = false];
  48. }
  49. </textarea></form>
  50. <script>
  51. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
  52. </script>
  53. <p><strong>MIME types defined:</strong> <code>text/x-protobuf</code>.</p>
  54. </article>