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.

121 lines
3.0 KiB

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