本站源代码
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.

137 lines
3.6KB

  1. <!doctype html>
  2. <title>CodeMirror: GFM 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="../xml/xml.js"></script>
  9. <script src="../markdown/markdown.js"></script>
  10. <script src="gfm.js"></script>
  11. <script src="../javascript/javascript.js"></script>
  12. <script src="../css/css.js"></script>
  13. <script src="../htmlmixed/htmlmixed.js"></script>
  14. <script src="../clike/clike.js"></script>
  15. <script src="../meta.js"></script>
  16. <style>
  17. .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
  18. .cm-s-default .cm-emoji {color: #009688;}
  19. </style>
  20. <div id=nav>
  21. <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  22. <ul>
  23. <li><a href="../../index.html">Home</a>
  24. <li><a href="../../doc/manual.html">Manual</a>
  25. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  26. </ul>
  27. <ul>
  28. <li><a href="../index.html">Language modes</a>
  29. <li><a class=active href="#">GFM</a>
  30. </ul>
  31. </div>
  32. <article>
  33. <h2>GFM mode</h2>
  34. <form><textarea id="code" name="code">
  35. GitHub Flavored Markdown
  36. ========================
  37. Everything from markdown plus GFM features:
  38. ## URL autolinking
  39. Underscores_are_allowed_between_words.
  40. ## Strikethrough text
  41. GFM adds syntax to strikethrough text, which is missing from standard Markdown.
  42. ~~Mistaken text.~~
  43. ~~**works with other formatting**~~
  44. ~~spans across
  45. lines~~
  46. ## Fenced code blocks (and syntax highlighting)
  47. ```javascript
  48. for (var i = 0; i &lt; items.length; i++) {
  49. console.log(items[i], i); // log them
  50. }
  51. ```
  52. ## Task Lists
  53. - [ ] Incomplete task list item
  54. - [x] **Completed** task list item
  55. ## A bit of GitHub spice
  56. See http://github.github.com/github-flavored-markdown/.
  57. (Set `gitHubSpice: false` in mode options to disable):
  58. * SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
  59. * User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
  60. * User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
  61. * \#Num: #1
  62. * User/#Num: mojombo#1
  63. * User/Project#Num: mojombo/god#1
  64. (Set `emoji: false` in mode options to disable):
  65. * emoji: :smile:
  66. </textarea></form>
  67. <script>
  68. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  69. mode: {
  70. name: "gfm",
  71. tokenTypeOverrides: {
  72. emoji: "emoji"
  73. }
  74. },
  75. lineNumbers: true,
  76. theme: "default"
  77. });
  78. </script>
  79. <p>Optionally depends on other modes for properly highlighted code blocks.</p>
  80. <p>Gfm mode supports these options (apart those from base Markdown mode):</p>
  81. <ul>
  82. <li>
  83. <d1>
  84. <dt><code>gitHubSpice: boolean</code></dt>
  85. <dd>Hashes, issues... (default: <code>true</code>).</dd>
  86. </d1>
  87. </li>
  88. <li>
  89. <d1>
  90. <dt><code>taskLists: boolean</code></dt>
  91. <dd><code>- [ ]</code> syntax (default: <code>true</code>).</dd>
  92. </d1>
  93. </li>
  94. <li>
  95. <d1>
  96. <dt><code>strikethrough: boolean</code></dt>
  97. <dd><code>~~foo~~</code> syntax (default: <code>true</code>).</dd>
  98. </d1>
  99. </li>
  100. <li>
  101. <d1>
  102. <dt><code>emoji: boolean</code></dt>
  103. <dd><code>:emoji:</code> syntax (default: <code>true</code>).</dd>
  104. </d1>
  105. </li>
  106. </ul>
  107. <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#gfm_*">normal</a>, <a href="../../test/index.html#verbose,gfm_*">verbose</a>.</p>
  108. </article>
上海开阖软件有限公司 沪ICP备12045867号-1