| 1 | <!doctype html> |
| 2 | |
| 3 | <title>CodeMirror: YAML 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="yaml.js"></script> |
| 10 | <style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style> |
| 11 | <div id=nav> |
| 12 | <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> |
| 13 | |
| 14 | <ul> |
| 15 | <li><a href="../../index.html">Home</a> |
| 16 | <li><a href="../../doc/manual.html">Manual</a> |
| 17 | <li><a href="https://github.com/codemirror/codemirror">Code</a> |
| 18 | </ul> |
| 19 | <ul> |
| 20 | <li><a href="../index.html">Language modes</a> |
| 21 | <li><a class=active href="#">YAML</a> |
| 22 | </ul> |
| 23 | </div> |
| 24 | |
| 25 | <article> |
| 26 | <h2>YAML mode</h2> |
| 27 | <form><textarea id="code" name="code"> |
| 28 | --- # Favorite movies |
| 29 | - Casablanca |
| 30 | - North by Northwest |
| 31 | - The Man Who Wasn't There |
| 32 | --- # Shopping list |
| 33 | [milk, pumpkin pie, eggs, juice] |
| 34 | --- # Indented Blocks, common in YAML data files, use indentation and new lines to separate the key: value pairs |
| 35 | name: John Smith |
| 36 | age: 33 |
| 37 | --- # Inline Blocks, common in YAML data streams, use commas to separate the key: value pairs between braces |
| 38 | {name: John Smith, age: 33} |
| 39 | --- |
| 40 | receipt: Oz-Ware Purchase Invoice |
| 41 | date: 2007-08-06 |
| 42 | customer: |
| 43 | given: Dorothy |
| 44 | family: Gale |
| 45 | |
| 46 | items: |
| 47 | - part_no: A4786 |
| 48 | descrip: Water Bucket (Filled) |
| 49 | price: 1.47 |
| 50 | quantity: 4 |
| 51 | |
| 52 | - part_no: E1628 |
| 53 | descrip: High Heeled "Ruby" Slippers |
| 54 | size: 8 |
| 55 | price: 100.27 |
| 56 | quantity: 1 |
| 57 | |
| 58 | bill-to: &id001 |
| 59 | street: | |
| 60 | 123 Tornado Alley |
| 61 | Suite 16 |
| 62 | city: East Centerville |
| 63 | state: KS |
| 64 | |
| 65 | ship-to: *id001 |
| 66 | |
| 67 | specialDelivery: > |
| 68 | Follow the Yellow Brick |
| 69 | Road to the Emerald City. |
| 70 | Pay no attention to the |
| 71 | man behind the curtain. |
| 72 | ... |
| 73 | </textarea></form> |
| 74 | <script> |
| 75 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), {}); |
| 76 | </script> |
| 77 | |
| 78 | <p><strong>MIME types defined:</strong> <code>text/x-yaml</code>.</p> |
| 79 | |
| 80 | </article> |