| 1 |
<!doctype html> |
| 2 |
|
| 3 |
<title>CodeMirror: YAML front matter 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/overlay.js"></script> |
| 10 |
<script src="../markdown/markdown.js"></script> |
| 11 |
<script src="../gfm/gfm.js"></script> |
| 12 |
<script src="../yaml/yaml.js"></script> |
| 13 |
<script src="yaml-frontmatter.js"></script> |
| 14 |
<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style> |
| 15 |
<div id=nav> |
| 16 |
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></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="#">YAML-Frontmatter</a> |
| 26 |
</ul> |
| 27 |
</div> |
| 28 |
|
| 29 |
<article> |
| 30 |
<h2>YAML front matter mode</h2> |
| 31 |
<form><textarea id="code" name="code"> |
| 32 |
--- |
| 33 |
receipt: Oz-Ware Purchase Invoice |
| 34 |
date: 2007-08-06 |
| 35 |
customer: |
| 36 |
given: Dorothy |
| 37 |
family: Gale |
| 38 |
|
| 39 |
items: |
| 40 |
- part_no: A4786 |
| 41 |
descrip: Water Bucket (Filled) |
| 42 |
price: 1.47 |
| 43 |
quantity: 4 |
| 44 |
|
| 45 |
- part_no: E1628 |
| 46 |
descrip: High Heeled "Ruby" Slippers |
| 47 |
size: 8 |
| 48 |
price: 100.27 |
| 49 |
quantity: 1 |
| 50 |
|
| 51 |
bill-to: &id001 |
| 52 |
street: | |
| 53 |
123 Tornado Alley |
| 54 |
Suite 16 |
| 55 |
city: East Centerville |
| 56 |
state: KS |
| 57 |
|
| 58 |
ship-to: *id001 |
| 59 |
|
| 60 |
specialDelivery: > |
| 61 |
Follow the Yellow Brick |
| 62 |
Road to the Emerald City. |
| 63 |
Pay no attention to the |
| 64 |
man behind the curtain. |
| 65 |
--- |
| 66 |
|
| 67 |
GitHub Flavored Markdown |
| 68 |
======================== |
| 69 |
|
| 70 |
Everything from markdown plus GFM features: |
| 71 |
|
| 72 |
## URL autolinking |
| 73 |
|
| 74 |
Underscores_are_allowed_between_words. |
| 75 |
|
| 76 |
## Strikethrough text |
| 77 |
|
| 78 |
GFM adds syntax to strikethrough text, which is missing from standard Markdown. |
| 79 |
|
| 80 |
~~Mistaken text.~~ |
| 81 |
~~**works with other formatting**~~ |
| 82 |
|
| 83 |
~~spans across |
| 84 |
lines~~ |
| 85 |
|
| 86 |
## Fenced code blocks (and syntax highlighting) |
| 87 |
|
| 88 |
```javascript |
| 89 |
for (var i = 0; i < items.length; i++) { |
| 90 |
console.log(items[i], i); // log them |
| 91 |
} |
| 92 |
``` |
| 93 |
|
| 94 |
## Task Lists |
| 95 |
|
| 96 |
- [ ] Incomplete task list item |
| 97 |
- [x] **Completed** task list item |
| 98 |
|
| 99 |
## A bit of GitHub spice |
| 100 |
|
| 101 |
* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2 |
| 102 |
* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2 |
| 103 |
* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2 |
| 104 |
* \#Num: #1 |
| 105 |
* User/#Num: mojombo#1 |
| 106 |
* User/Project#Num: mojombo/god#1 |
| 107 |
|
| 108 |
See http://github.github.com/github-flavored-markdown/. |
| 109 |
</textarea></form> |
| 110 |
|
| 111 |
<p>Defines a mode that parses |
| 112 |
a <a href="http://jekyllrb.com/docs/frontmatter/">YAML frontmatter</a> |
| 113 |
at the start of a file, switching to a base mode at the end of that. |
| 114 |
Takes a mode configuration option <code>base</code> to configure the |
| 115 |
base mode, which defaults to <code>"gfm"</code>.</p> |
| 116 |
|
| 117 |
<script> |
| 118 |
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "yaml-frontmatter"}); |
| 119 |
</script> |
| 120 |
|
| 121 |
</article> |