rails_db 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/app/assets/javascripts/codemirror/codemirror.js +9762 -0
  4. data/app/assets/javascripts/codemirror/codemirror/addons/comment/comment.js +209 -0
  5. data/app/assets/javascripts/codemirror/codemirror/addons/comment/continuecomment.js +78 -0
  6. data/app/assets/javascripts/codemirror/codemirror/addons/dialog/dialog.js +161 -0
  7. data/app/assets/javascripts/codemirror/codemirror/addons/display/autorefresh.js +47 -0
  8. data/app/assets/javascripts/codemirror/codemirror/addons/display/fullscreen.js +41 -0
  9. data/app/assets/javascripts/codemirror/codemirror/addons/display/panel.js +127 -0
  10. data/app/assets/javascripts/codemirror/codemirror/addons/display/placeholder.js +63 -0
  11. data/app/assets/javascripts/codemirror/codemirror/addons/display/rulers.js +51 -0
  12. data/app/assets/javascripts/codemirror/codemirror/addons/edit/closebrackets.js +191 -0
  13. data/app/assets/javascripts/codemirror/codemirror/addons/edit/closetag.js +183 -0
  14. data/app/assets/javascripts/codemirror/codemirror/addons/edit/continuelist.js +99 -0
  15. data/app/assets/javascripts/codemirror/codemirror/addons/edit/matchbrackets.js +150 -0
  16. data/app/assets/javascripts/codemirror/codemirror/addons/edit/matchtags.js +66 -0
  17. data/app/assets/javascripts/codemirror/codemirror/addons/edit/trailingspace.js +27 -0
  18. data/app/assets/javascripts/codemirror/codemirror/addons/fold/brace-fold.js +105 -0
  19. data/app/assets/javascripts/codemirror/codemirror/addons/fold/comment-fold.js +59 -0
  20. data/app/assets/javascripts/codemirror/codemirror/addons/fold/foldcode.js +152 -0
  21. data/app/assets/javascripts/codemirror/codemirror/addons/fold/foldgutter.js +146 -0
  22. data/app/assets/javascripts/codemirror/codemirror/addons/fold/indent-fold.js +48 -0
  23. data/app/assets/javascripts/codemirror/codemirror/addons/fold/markdown-fold.js +49 -0
  24. data/app/assets/javascripts/codemirror/codemirror/addons/fold/xml-fold.js +184 -0
  25. data/app/assets/javascripts/codemirror/codemirror/addons/hint/anyword-hint.js +41 -0
  26. data/app/assets/javascripts/codemirror/codemirror/addons/hint/css-hint.js +60 -0
  27. data/app/assets/javascripts/codemirror/codemirror/addons/hint/html-hint.js +350 -0
  28. data/app/assets/javascripts/codemirror/codemirror/addons/hint/javascript-hint.js +157 -0
  29. data/app/assets/javascripts/codemirror/codemirror/addons/hint/show-hint.js +460 -0
  30. data/app/assets/javascripts/codemirror/codemirror/addons/hint/sql-hint.js +304 -0
  31. data/app/assets/javascripts/codemirror/codemirror/addons/hint/xml-hint.js +120 -0
  32. data/app/assets/javascripts/codemirror/codemirror/addons/lint/coffeescript-lint.js +47 -0
  33. data/app/assets/javascripts/codemirror/codemirror/addons/lint/css-lint.js +40 -0
  34. data/app/assets/javascripts/codemirror/codemirror/addons/lint/html-lint.js +59 -0
  35. data/app/assets/javascripts/codemirror/codemirror/addons/lint/javascript-lint.js +63 -0
  36. data/app/assets/javascripts/codemirror/codemirror/addons/lint/json-lint.js +40 -0
  37. data/app/assets/javascripts/codemirror/codemirror/addons/lint/lint.js +252 -0
  38. data/app/assets/javascripts/codemirror/codemirror/addons/lint/yaml-lint.js +41 -0
  39. data/app/assets/javascripts/codemirror/codemirror/addons/merge/merge.js +1002 -0
  40. data/app/assets/javascripts/codemirror/codemirror/addons/mode/loadmode.js +64 -0
  41. data/app/assets/javascripts/codemirror/codemirror/addons/mode/multiplex.js +131 -0
  42. data/app/assets/javascripts/codemirror/codemirror/addons/mode/multiplex_test.js +33 -0
  43. data/app/assets/javascripts/codemirror/codemirror/addons/mode/overlay.js +90 -0
  44. data/app/assets/javascripts/codemirror/codemirror/addons/mode/simple.js +216 -0
  45. data/app/assets/javascripts/codemirror/codemirror/addons/runmode/colorize.js +40 -0
  46. data/app/assets/javascripts/codemirror/codemirror/addons/runmode/runmode-standalone.js +158 -0
  47. data/app/assets/javascripts/codemirror/codemirror/addons/runmode/runmode.js +72 -0
  48. data/app/assets/javascripts/codemirror/codemirror/addons/runmode/runmode.node.js +197 -0
  49. data/app/assets/javascripts/codemirror/codemirror/addons/scroll/annotatescrollbar.js +122 -0
  50. data/app/assets/javascripts/codemirror/codemirror/addons/scroll/scrollpastend.js +48 -0
  51. data/app/assets/javascripts/codemirror/codemirror/addons/scroll/simplescrollbars.js +152 -0
  52. data/app/assets/javascripts/codemirror/codemirror/addons/search/jump-to-line.js +50 -0
  53. data/app/assets/javascripts/codemirror/codemirror/addons/search/match-highlighter.js +165 -0
  54. data/app/assets/javascripts/codemirror/codemirror/addons/search/matchesonscrollbar.js +97 -0
  55. data/app/assets/javascripts/codemirror/codemirror/addons/search/search.js +260 -0
  56. data/app/assets/javascripts/codemirror/codemirror/addons/search/searchcursor.js +293 -0
  57. data/app/assets/javascripts/codemirror/codemirror/addons/selection/active-line.js +72 -0
  58. data/app/assets/javascripts/codemirror/codemirror/addons/selection/mark-selection.js +119 -0
  59. data/app/assets/javascripts/codemirror/codemirror/addons/selection/selection-pointer.js +98 -0
  60. data/app/assets/javascripts/codemirror/codemirror/addons/tern/tern.js +718 -0
  61. data/app/assets/javascripts/codemirror/codemirror/addons/tern/worker.js +44 -0
  62. data/app/assets/javascripts/codemirror/codemirror/addons/wrap/hardwrap.js +145 -0
  63. data/app/assets/javascripts/codemirror/codemirror/keymaps/emacs.js +418 -0
  64. data/app/assets/javascripts/codemirror/codemirror/keymaps/sublime.js +691 -0
  65. data/app/assets/javascripts/codemirror/codemirror/keymaps/vim.js +5494 -0
  66. data/app/assets/javascripts/codemirror/codemirror/modes/apl.js +174 -0
  67. data/app/assets/javascripts/codemirror/codemirror/modes/asciiarmor.js +74 -0
  68. data/app/assets/javascripts/codemirror/codemirror/modes/asn.1.js +204 -0
  69. data/app/assets/javascripts/codemirror/codemirror/modes/asterisk.js +196 -0
  70. data/app/assets/javascripts/codemirror/codemirror/modes/brainfuck.js +85 -0
  71. data/app/assets/javascripts/codemirror/codemirror/modes/clike.js +884 -0
  72. data/app/assets/javascripts/codemirror/codemirror/modes/clojure.js +292 -0
  73. data/app/assets/javascripts/codemirror/codemirror/modes/cmake.js +97 -0
  74. data/app/assets/javascripts/codemirror/codemirror/modes/cobol.js +255 -0
  75. data/app/assets/javascripts/codemirror/codemirror/modes/coffeescript.js +359 -0
  76. data/app/assets/javascripts/codemirror/codemirror/modes/commonlisp.js +124 -0
  77. data/app/assets/javascripts/codemirror/codemirror/modes/crystal.js +433 -0
  78. data/app/assets/javascripts/codemirror/codemirror/modes/css.js +831 -0
  79. data/app/assets/javascripts/codemirror/codemirror/modes/cypher.js +150 -0
  80. data/app/assets/javascripts/codemirror/codemirror/modes/d.js +223 -0
  81. data/app/assets/javascripts/codemirror/codemirror/modes/dart.js +157 -0
  82. data/app/assets/javascripts/codemirror/codemirror/modes/diff.js +47 -0
  83. data/app/assets/javascripts/codemirror/codemirror/modes/django.js +356 -0
  84. data/app/assets/javascripts/codemirror/codemirror/modes/dockerfile.js +211 -0
  85. data/app/assets/javascripts/codemirror/codemirror/modes/dtd.js +142 -0
  86. data/app/assets/javascripts/codemirror/codemirror/modes/dylan.js +352 -0
  87. data/app/assets/javascripts/codemirror/codemirror/modes/ebnf.js +195 -0
  88. data/app/assets/javascripts/codemirror/codemirror/modes/ecl.js +206 -0
  89. data/app/assets/javascripts/codemirror/codemirror/modes/eiffel.js +160 -0
  90. data/app/assets/javascripts/codemirror/codemirror/modes/elm.js +205 -0
  91. data/app/assets/javascripts/codemirror/codemirror/modes/erlang.js +619 -0
  92. data/app/assets/javascripts/codemirror/codemirror/modes/factor.js +85 -0
  93. data/app/assets/javascripts/codemirror/codemirror/modes/fcl.js +173 -0
  94. data/app/assets/javascripts/codemirror/codemirror/modes/forth.js +180 -0
  95. data/app/assets/javascripts/codemirror/codemirror/modes/fortran.js +188 -0
  96. data/app/assets/javascripts/codemirror/codemirror/modes/gas.js +345 -0
  97. data/app/assets/javascripts/codemirror/codemirror/modes/gfm.js +129 -0
  98. data/app/assets/javascripts/codemirror/codemirror/modes/gherkin.js +178 -0
  99. data/app/assets/javascripts/codemirror/codemirror/modes/go.js +187 -0
  100. data/app/assets/javascripts/codemirror/codemirror/modes/groovy.js +233 -0
  101. data/app/assets/javascripts/codemirror/codemirror/modes/haml.js +161 -0
  102. data/app/assets/javascripts/codemirror/codemirror/modes/handlebars.js +66 -0
  103. data/app/assets/javascripts/codemirror/codemirror/modes/haskell-literate.js +43 -0
  104. data/app/assets/javascripts/codemirror/codemirror/modes/haskell.js +268 -0
  105. data/app/assets/javascripts/codemirror/codemirror/modes/haxe.js +515 -0
  106. data/app/assets/javascripts/codemirror/codemirror/modes/htmlembedded.js +37 -0
  107. data/app/assets/javascripts/codemirror/codemirror/modes/htmlmixed.js +152 -0
  108. data/app/assets/javascripts/codemirror/codemirror/modes/http.js +113 -0
  109. data/app/assets/javascripts/codemirror/codemirror/modes/idl.js +290 -0
  110. data/app/assets/javascripts/codemirror/codemirror/modes/jade.js +590 -0
  111. data/app/assets/javascripts/codemirror/codemirror/modes/javascript.js +927 -0
  112. data/app/assets/javascripts/codemirror/codemirror/modes/jinja2.js +146 -0
  113. data/app/assets/javascripts/codemirror/codemirror/modes/jsx.js +148 -0
  114. data/app/assets/javascripts/codemirror/codemirror/modes/julia.js +431 -0
  115. data/app/assets/javascripts/codemirror/codemirror/modes/livescript.js +280 -0
  116. data/app/assets/javascripts/codemirror/codemirror/modes/lua.js +159 -0
  117. data/app/assets/javascripts/codemirror/codemirror/modes/markdown.js +884 -0
  118. data/app/assets/javascripts/codemirror/codemirror/modes/mathematica.js +176 -0
  119. data/app/assets/javascripts/codemirror/codemirror/modes/mbox.js +129 -0
  120. data/app/assets/javascripts/codemirror/codemirror/modes/meta.js +218 -0
  121. data/app/assets/javascripts/codemirror/codemirror/modes/mirc.js +193 -0
  122. data/app/assets/javascripts/codemirror/codemirror/modes/mllike.js +359 -0
  123. data/app/assets/javascripts/codemirror/codemirror/modes/modelica.js +245 -0
  124. data/app/assets/javascripts/codemirror/codemirror/modes/mscgen.js +175 -0
  125. data/app/assets/javascripts/codemirror/codemirror/modes/mumps.js +148 -0
  126. data/app/assets/javascripts/codemirror/codemirror/modes/nginx.js +178 -0
  127. data/app/assets/javascripts/codemirror/codemirror/modes/nsis.js +95 -0
  128. data/app/assets/javascripts/codemirror/codemirror/modes/ntriples.js +195 -0
  129. data/app/assets/javascripts/codemirror/codemirror/modes/octave.js +139 -0
  130. data/app/assets/javascripts/codemirror/codemirror/modes/oz.js +252 -0
  131. data/app/assets/javascripts/codemirror/codemirror/modes/pascal.js +121 -0
  132. data/app/assets/javascripts/codemirror/codemirror/modes/pegjs.js +114 -0
  133. data/app/assets/javascripts/codemirror/codemirror/modes/perl.js +837 -0
  134. data/app/assets/javascripts/codemirror/codemirror/modes/php.js +234 -0
  135. data/app/assets/javascripts/codemirror/codemirror/modes/pig.js +178 -0
  136. data/app/assets/javascripts/codemirror/codemirror/modes/powershell.js +398 -0
  137. data/app/assets/javascripts/codemirror/codemirror/modes/properties.js +78 -0
  138. data/app/assets/javascripts/codemirror/codemirror/modes/protobuf.js +69 -0
  139. data/app/assets/javascripts/codemirror/codemirror/modes/pug.js +591 -0
  140. data/app/assets/javascripts/codemirror/codemirror/modes/puppet.js +220 -0
  141. data/app/assets/javascripts/codemirror/codemirror/modes/python.js +399 -0
  142. data/app/assets/javascripts/codemirror/codemirror/modes/q.js +139 -0
  143. data/app/assets/javascripts/codemirror/codemirror/modes/r.js +190 -0
  144. data/app/assets/javascripts/codemirror/codemirror/modes/rpm.js +109 -0
  145. data/app/assets/javascripts/codemirror/codemirror/modes/rst.js +557 -0
  146. data/app/assets/javascripts/codemirror/codemirror/modes/ruby.js +298 -0
  147. data/app/assets/javascripts/codemirror/codemirror/modes/rust.js +72 -0
  148. data/app/assets/javascripts/codemirror/codemirror/modes/sas.js +303 -0
  149. data/app/assets/javascripts/codemirror/codemirror/modes/sass.js +454 -0
  150. data/app/assets/javascripts/codemirror/codemirror/modes/scheme.js +265 -0
  151. data/app/assets/javascripts/codemirror/codemirror/modes/shell.js +152 -0
  152. data/app/assets/javascripts/codemirror/codemirror/modes/sieve.js +193 -0
  153. data/app/assets/javascripts/codemirror/codemirror/modes/slim.js +575 -0
  154. data/app/assets/javascripts/codemirror/codemirror/modes/smalltalk.js +168 -0
  155. data/app/assets/javascripts/codemirror/codemirror/modes/smarty.js +225 -0
  156. data/app/assets/javascripts/codemirror/codemirror/modes/solr.js +104 -0
  157. data/app/assets/javascripts/codemirror/codemirror/modes/soy.js +435 -0
  158. data/app/assets/javascripts/codemirror/codemirror/modes/sparql.js +180 -0
  159. data/app/assets/javascripts/codemirror/codemirror/modes/spreadsheet.js +112 -0
  160. data/app/assets/javascripts/codemirror/codemirror/modes/sql.js +494 -0
  161. data/app/assets/javascripts/codemirror/codemirror/modes/stex.js +264 -0
  162. data/app/assets/javascripts/codemirror/codemirror/modes/stylus.js +771 -0
  163. data/app/assets/javascripts/codemirror/codemirror/modes/swift.js +223 -0
  164. data/app/assets/javascripts/codemirror/codemirror/modes/tcl.js +139 -0
  165. data/app/assets/javascripts/codemirror/codemirror/modes/textile.js +469 -0
  166. data/app/assets/javascripts/codemirror/codemirror/modes/tiddlywiki.js +308 -0
  167. data/app/assets/javascripts/codemirror/codemirror/modes/tiki.js +312 -0
  168. data/app/assets/javascripts/codemirror/codemirror/modes/toml.js +88 -0
  169. data/app/assets/javascripts/codemirror/codemirror/modes/tornado.js +68 -0
  170. data/app/assets/javascripts/codemirror/codemirror/modes/troff.js +84 -0
  171. data/app/assets/javascripts/codemirror/codemirror/modes/ttcn-cfg.js +214 -0
  172. data/app/assets/javascripts/codemirror/codemirror/modes/ttcn.js +283 -0
  173. data/app/assets/javascripts/codemirror/codemirror/modes/turtle.js +162 -0
  174. data/app/assets/javascripts/codemirror/codemirror/modes/twig.js +141 -0
  175. data/app/assets/javascripts/codemirror/codemirror/modes/vb.js +275 -0
  176. data/app/assets/javascripts/codemirror/codemirror/modes/vbscript.js +350 -0
  177. data/app/assets/javascripts/codemirror/codemirror/modes/velocity.js +201 -0
  178. data/app/assets/javascripts/codemirror/codemirror/modes/verilog.js +675 -0
  179. data/app/assets/javascripts/codemirror/codemirror/modes/vhdl.js +189 -0
  180. data/app/assets/javascripts/codemirror/codemirror/modes/vue.js +77 -0
  181. data/app/assets/javascripts/codemirror/codemirror/modes/webidl.js +195 -0
  182. data/app/assets/javascripts/codemirror/codemirror/modes/xml.js +402 -0
  183. data/app/assets/javascripts/codemirror/codemirror/modes/xquery.js +448 -0
  184. data/app/assets/javascripts/codemirror/codemirror/modes/yacas.js +204 -0
  185. data/app/assets/javascripts/codemirror/codemirror/modes/yaml-frontmatter.js +68 -0
  186. data/app/assets/javascripts/codemirror/codemirror/modes/yaml.js +120 -0
  187. data/app/assets/javascripts/codemirror/codemirror/modes/z80.js +116 -0
  188. data/app/assets/javascripts/rails_db/application.js +4 -4
  189. data/app/assets/stylesheets/codemirror/codemirror.css +346 -0
  190. data/app/assets/stylesheets/codemirror/codemirror/addons/dialog/dialog.css +32 -0
  191. data/app/assets/stylesheets/codemirror/codemirror/addons/display/fullscreen.css +6 -0
  192. data/app/assets/stylesheets/codemirror/codemirror/addons/fold/foldgutter.css +20 -0
  193. data/app/assets/stylesheets/codemirror/codemirror/addons/hint/show-hint.css +36 -0
  194. data/app/assets/stylesheets/codemirror/codemirror/addons/lint/lint.css +73 -0
  195. data/app/assets/stylesheets/codemirror/codemirror/addons/merge/merge.css +119 -0
  196. data/app/assets/stylesheets/codemirror/codemirror/addons/scroll/simplescrollbars.css +66 -0
  197. data/app/assets/stylesheets/codemirror/codemirror/addons/search/matchesonscrollbar.css +8 -0
  198. data/app/assets/stylesheets/codemirror/codemirror/addons/tern/tern.css +87 -0
  199. data/app/assets/stylesheets/codemirror/codemirror/modes/tiddlywiki.css +14 -0
  200. data/app/assets/stylesheets/codemirror/codemirror/modes/tiki.css +26 -0
  201. data/app/assets/stylesheets/codemirror/codemirror/themes/3024-day.css +41 -0
  202. data/app/assets/stylesheets/codemirror/codemirror/themes/3024-night.css +39 -0
  203. data/app/assets/stylesheets/codemirror/codemirror/themes/abcdef.css +32 -0
  204. data/app/assets/stylesheets/codemirror/codemirror/themes/ambiance-mobile.css +5 -0
  205. data/app/assets/stylesheets/codemirror/codemirror/themes/ambiance.css +74 -0
  206. data/app/assets/stylesheets/codemirror/codemirror/themes/base16-dark.css +38 -0
  207. data/app/assets/stylesheets/codemirror/codemirror/themes/base16-light.css +38 -0
  208. data/app/assets/stylesheets/codemirror/codemirror/themes/bespin.css +34 -0
  209. data/app/assets/stylesheets/codemirror/codemirror/themes/blackboard.css +32 -0
  210. data/app/assets/stylesheets/codemirror/codemirror/themes/cobalt.css +25 -0
  211. data/app/assets/stylesheets/codemirror/codemirror/themes/colorforth.css +33 -0
  212. data/app/assets/stylesheets/codemirror/codemirror/themes/darcula.css +51 -0
  213. data/app/assets/stylesheets/codemirror/codemirror/themes/dracula.css +40 -0
  214. data/app/assets/stylesheets/codemirror/codemirror/themes/duotone-dark.css +35 -0
  215. data/app/assets/stylesheets/codemirror/codemirror/themes/duotone-light.css +36 -0
  216. data/app/assets/stylesheets/codemirror/codemirror/themes/eclipse.css +23 -0
  217. data/app/assets/stylesheets/codemirror/codemirror/themes/elegant.css +13 -0
  218. data/app/assets/stylesheets/codemirror/codemirror/themes/erlang-dark.css +34 -0
  219. data/app/assets/stylesheets/codemirror/codemirror/themes/gruvbox-dark.css +37 -0
  220. data/app/assets/stylesheets/codemirror/codemirror/themes/hopscotch.css +34 -0
  221. data/app/assets/stylesheets/codemirror/codemirror/themes/icecoder.css +43 -0
  222. data/app/assets/stylesheets/codemirror/codemirror/themes/idea.css +42 -0
  223. data/app/assets/stylesheets/codemirror/codemirror/themes/isotope.css +34 -0
  224. data/app/assets/stylesheets/codemirror/codemirror/themes/lesser-dark.css +47 -0
  225. data/app/assets/stylesheets/codemirror/codemirror/themes/liquibyte.css +95 -0
  226. data/app/assets/stylesheets/codemirror/codemirror/themes/lucario.css +37 -0
  227. data/app/assets/stylesheets/codemirror/codemirror/themes/material.css +53 -0
  228. data/app/assets/stylesheets/codemirror/codemirror/themes/mbo.css +37 -0
  229. data/app/assets/stylesheets/codemirror/codemirror/themes/mdn-like.css +46 -0
  230. data/app/assets/stylesheets/codemirror/codemirror/themes/midnight.css +39 -0
  231. data/app/assets/stylesheets/codemirror/codemirror/themes/monokai.css +41 -0
  232. data/app/assets/stylesheets/codemirror/codemirror/themes/neat.css +12 -0
  233. data/app/assets/stylesheets/codemirror/codemirror/themes/neo.css +43 -0
  234. data/app/assets/stylesheets/codemirror/codemirror/themes/night.css +27 -0
  235. data/app/assets/stylesheets/codemirror/codemirror/themes/nord.css +42 -0
  236. data/app/assets/stylesheets/codemirror/codemirror/themes/oceanic-next.css +44 -0
  237. data/app/assets/stylesheets/codemirror/codemirror/themes/panda-syntax.css +85 -0
  238. data/app/assets/stylesheets/codemirror/codemirror/themes/paraiso-dark.css +38 -0
  239. data/app/assets/stylesheets/codemirror/codemirror/themes/paraiso-light.css +38 -0
  240. data/app/assets/stylesheets/codemirror/codemirror/themes/pastel-on-dark.css +52 -0
  241. data/app/assets/stylesheets/codemirror/codemirror/themes/railscasts.css +34 -0
  242. data/app/assets/stylesheets/codemirror/codemirror/themes/rubyblue.css +25 -0
  243. data/app/assets/stylesheets/codemirror/codemirror/themes/seti.css +44 -0
  244. data/app/assets/stylesheets/codemirror/codemirror/themes/shadowfox.css +52 -0
  245. data/app/assets/stylesheets/codemirror/codemirror/themes/solarized.css +168 -0
  246. data/app/assets/stylesheets/codemirror/codemirror/themes/ssms.css +16 -0
  247. data/app/assets/stylesheets/codemirror/codemirror/themes/the-matrix.css +30 -0
  248. data/app/assets/stylesheets/codemirror/codemirror/themes/tomorrow-night-bright.css +35 -0
  249. data/app/assets/stylesheets/codemirror/codemirror/themes/tomorrow-night-eighties.css +38 -0
  250. data/app/assets/stylesheets/codemirror/codemirror/themes/ttcn.css +64 -0
  251. data/app/assets/stylesheets/codemirror/codemirror/themes/twilight.css +32 -0
  252. data/app/assets/stylesheets/codemirror/codemirror/themes/vibrant-ink.css +34 -0
  253. data/app/assets/stylesheets/codemirror/codemirror/themes/xq-dark.css +53 -0
  254. data/app/assets/stylesheets/codemirror/codemirror/themes/xq-light.css +43 -0
  255. data/app/assets/stylesheets/codemirror/codemirror/themes/zenburn.css +37 -0
  256. data/app/assets/stylesheets/rails_db/application.css +3 -3
  257. data/lib/rails_db/engine.rb +1 -1
  258. data/lib/rails_db/version.rb +1 -1
  259. metadata +253 -1
@@ -0,0 +1,280 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3
+
4
+ /**
5
+ * Link to the project's GitHub page:
6
+ * https://github.com/duralog/CodeMirror
7
+ */
8
+
9
+ (function(mod) {
10
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
11
+ mod(require("../../lib/codemirror"));
12
+ else if (typeof define == "function" && define.amd) // AMD
13
+ define(["../../lib/codemirror"], mod);
14
+ else // Plain browser env
15
+ mod(CodeMirror);
16
+ })(function(CodeMirror) {
17
+ "use strict";
18
+
19
+ CodeMirror.defineMode('livescript', function(){
20
+ var tokenBase = function(stream, state) {
21
+ var next_rule = state.next || "start";
22
+ if (next_rule) {
23
+ state.next = state.next;
24
+ var nr = Rules[next_rule];
25
+ if (nr.splice) {
26
+ for (var i$ = 0; i$ < nr.length; ++i$) {
27
+ var r = nr[i$];
28
+ if (r.regex && stream.match(r.regex)) {
29
+ state.next = r.next || state.next;
30
+ return r.token;
31
+ }
32
+ }
33
+ stream.next();
34
+ return 'error';
35
+ }
36
+ if (stream.match(r = Rules[next_rule])) {
37
+ if (r.regex && stream.match(r.regex)) {
38
+ state.next = r.next;
39
+ return r.token;
40
+ } else {
41
+ stream.next();
42
+ return 'error';
43
+ }
44
+ }
45
+ }
46
+ stream.next();
47
+ return 'error';
48
+ };
49
+ var external = {
50
+ startState: function(){
51
+ return {
52
+ next: 'start',
53
+ lastToken: {style: null, indent: 0, content: ""}
54
+ };
55
+ },
56
+ token: function(stream, state){
57
+ while (stream.pos == stream.start)
58
+ var style = tokenBase(stream, state);
59
+ state.lastToken = {
60
+ style: style,
61
+ indent: stream.indentation(),
62
+ content: stream.current()
63
+ };
64
+ return style.replace(/\./g, ' ');
65
+ },
66
+ indent: function(state){
67
+ var indentation = state.lastToken.indent;
68
+ if (state.lastToken.content.match(indenter)) {
69
+ indentation += 2;
70
+ }
71
+ return indentation;
72
+ }
73
+ };
74
+ return external;
75
+ });
76
+
77
+ var identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
78
+ var indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
79
+ var keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
80
+ var stringfill = {
81
+ token: 'string',
82
+ regex: '.+'
83
+ };
84
+ var Rules = {
85
+ start: [
86
+ {
87
+ token: 'comment.doc',
88
+ regex: '/\\*',
89
+ next: 'comment'
90
+ }, {
91
+ token: 'comment',
92
+ regex: '#.*'
93
+ }, {
94
+ token: 'keyword',
95
+ regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend
96
+ }, {
97
+ token: 'constant.language',
98
+ regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
99
+ }, {
100
+ token: 'invalid.illegal',
101
+ regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
102
+ }, {
103
+ token: 'language.support.class',
104
+ regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
105
+ }, {
106
+ token: 'language.support.function',
107
+ regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
108
+ }, {
109
+ token: 'variable.language',
110
+ regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
111
+ }, {
112
+ token: 'identifier',
113
+ regex: identifier + '\\s*:(?![:=])'
114
+ }, {
115
+ token: 'variable',
116
+ regex: identifier
117
+ }, {
118
+ token: 'keyword.operator',
119
+ regex: '(?:\\.{3}|\\s+\\?)'
120
+ }, {
121
+ token: 'keyword.variable',
122
+ regex: '(?:@+|::|\\.\\.)',
123
+ next: 'key'
124
+ }, {
125
+ token: 'keyword.operator',
126
+ regex: '\\.\\s*',
127
+ next: 'key'
128
+ }, {
129
+ token: 'string',
130
+ regex: '\\\\\\S[^\\s,;)}\\]]*'
131
+ }, {
132
+ token: 'string.doc',
133
+ regex: '\'\'\'',
134
+ next: 'qdoc'
135
+ }, {
136
+ token: 'string.doc',
137
+ regex: '"""',
138
+ next: 'qqdoc'
139
+ }, {
140
+ token: 'string',
141
+ regex: '\'',
142
+ next: 'qstring'
143
+ }, {
144
+ token: 'string',
145
+ regex: '"',
146
+ next: 'qqstring'
147
+ }, {
148
+ token: 'string',
149
+ regex: '`',
150
+ next: 'js'
151
+ }, {
152
+ token: 'string',
153
+ regex: '<\\[',
154
+ next: 'words'
155
+ }, {
156
+ token: 'string.regex',
157
+ regex: '//',
158
+ next: 'heregex'
159
+ }, {
160
+ token: 'string.regex',
161
+ regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
162
+ next: 'key'
163
+ }, {
164
+ token: 'constant.numeric',
165
+ regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)'
166
+ }, {
167
+ token: 'lparen',
168
+ regex: '[({[]'
169
+ }, {
170
+ token: 'rparen',
171
+ regex: '[)}\\]]',
172
+ next: 'key'
173
+ }, {
174
+ token: 'keyword.operator',
175
+ regex: '\\S+'
176
+ }, {
177
+ token: 'text',
178
+ regex: '\\s+'
179
+ }
180
+ ],
181
+ heregex: [
182
+ {
183
+ token: 'string.regex',
184
+ regex: '.*?//[gimy$?]{0,4}',
185
+ next: 'start'
186
+ }, {
187
+ token: 'string.regex',
188
+ regex: '\\s*#{'
189
+ }, {
190
+ token: 'comment.regex',
191
+ regex: '\\s+(?:#.*)?'
192
+ }, {
193
+ token: 'string.regex',
194
+ regex: '\\S+'
195
+ }
196
+ ],
197
+ key: [
198
+ {
199
+ token: 'keyword.operator',
200
+ regex: '[.?@!]+'
201
+ }, {
202
+ token: 'identifier',
203
+ regex: identifier,
204
+ next: 'start'
205
+ }, {
206
+ token: 'text',
207
+ regex: '',
208
+ next: 'start'
209
+ }
210
+ ],
211
+ comment: [
212
+ {
213
+ token: 'comment.doc',
214
+ regex: '.*?\\*/',
215
+ next: 'start'
216
+ }, {
217
+ token: 'comment.doc',
218
+ regex: '.+'
219
+ }
220
+ ],
221
+ qdoc: [
222
+ {
223
+ token: 'string',
224
+ regex: ".*?'''",
225
+ next: 'key'
226
+ }, stringfill
227
+ ],
228
+ qqdoc: [
229
+ {
230
+ token: 'string',
231
+ regex: '.*?"""',
232
+ next: 'key'
233
+ }, stringfill
234
+ ],
235
+ qstring: [
236
+ {
237
+ token: 'string',
238
+ regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
239
+ next: 'key'
240
+ }, stringfill
241
+ ],
242
+ qqstring: [
243
+ {
244
+ token: 'string',
245
+ regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
246
+ next: 'key'
247
+ }, stringfill
248
+ ],
249
+ js: [
250
+ {
251
+ token: 'string',
252
+ regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
253
+ next: 'key'
254
+ }, stringfill
255
+ ],
256
+ words: [
257
+ {
258
+ token: 'string',
259
+ regex: '.*?\\]>',
260
+ next: 'key'
261
+ }, stringfill
262
+ ]
263
+ };
264
+ for (var idx in Rules) {
265
+ var r = Rules[idx];
266
+ if (r.splice) {
267
+ for (var i = 0, len = r.length; i < len; ++i) {
268
+ var rr = r[i];
269
+ if (typeof rr.regex === 'string') {
270
+ Rules[idx][i].regex = new RegExp('^' + rr.regex);
271
+ }
272
+ }
273
+ } else if (typeof rr.regex === 'string') {
274
+ Rules[idx].regex = new RegExp('^' + r.regex);
275
+ }
276
+ }
277
+
278
+ CodeMirror.defineMIME('text/x-livescript', 'livescript');
279
+
280
+ });
@@ -0,0 +1,159 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3
+
4
+ // LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's
5
+ // CodeMirror 1 mode.
6
+ // highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting
7
+
8
+ (function(mod) {
9
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
10
+ mod(require("../../lib/codemirror"));
11
+ else if (typeof define == "function" && define.amd) // AMD
12
+ define(["../../lib/codemirror"], mod);
13
+ else // Plain browser env
14
+ mod(CodeMirror);
15
+ })(function(CodeMirror) {
16
+ "use strict";
17
+
18
+ CodeMirror.defineMode("lua", function(config, parserConfig) {
19
+ var indentUnit = config.indentUnit;
20
+
21
+ function prefixRE(words) {
22
+ return new RegExp("^(?:" + words.join("|") + ")", "i");
23
+ }
24
+ function wordRE(words) {
25
+ return new RegExp("^(?:" + words.join("|") + ")$", "i");
26
+ }
27
+ var specials = wordRE(parserConfig.specials || []);
28
+
29
+ // long list of standard functions from lua manual
30
+ var builtins = wordRE([
31
+ "_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load",
32
+ "loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require",
33
+ "select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall",
34
+
35
+ "coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield",
36
+
37
+ "debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable",
38
+ "debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable",
39
+ "debug.setupvalue","debug.traceback",
40
+
41
+ "close","flush","lines","read","seek","setvbuf","write",
42
+
43
+ "io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin",
44
+ "io.stdout","io.tmpfile","io.type","io.write",
45
+
46
+ "math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg",
47
+ "math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max",
48
+ "math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh",
49
+ "math.sqrt","math.tan","math.tanh",
50
+
51
+ "os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale",
52
+ "os.time","os.tmpname",
53
+
54
+ "package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload",
55
+ "package.seeall",
56
+
57
+ "string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub",
58
+ "string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper",
59
+
60
+ "table.concat","table.insert","table.maxn","table.remove","table.sort"
61
+ ]);
62
+ var keywords = wordRE(["and","break","elseif","false","nil","not","or","return",
63
+ "true","function", "end", "if", "then", "else", "do",
64
+ "while", "repeat", "until", "for", "in", "local" ]);
65
+
66
+ var indentTokens = wordRE(["function", "if","repeat","do", "\\(", "{"]);
67
+ var dedentTokens = wordRE(["end", "until", "\\)", "}"]);
68
+ var dedentPartial = prefixRE(["end", "until", "\\)", "}", "else", "elseif"]);
69
+
70
+ function readBracket(stream) {
71
+ var level = 0;
72
+ while (stream.eat("=")) ++level;
73
+ stream.eat("[");
74
+ return level;
75
+ }
76
+
77
+ function normal(stream, state) {
78
+ var ch = stream.next();
79
+ if (ch == "-" && stream.eat("-")) {
80
+ if (stream.eat("[") && stream.eat("["))
81
+ return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state);
82
+ stream.skipToEnd();
83
+ return "comment";
84
+ }
85
+ if (ch == "\"" || ch == "'")
86
+ return (state.cur = string(ch))(stream, state);
87
+ if (ch == "[" && /[\[=]/.test(stream.peek()))
88
+ return (state.cur = bracketed(readBracket(stream), "string"))(stream, state);
89
+ if (/\d/.test(ch)) {
90
+ stream.eatWhile(/[\w.%]/);
91
+ return "number";
92
+ }
93
+ if (/[\w_]/.test(ch)) {
94
+ stream.eatWhile(/[\w\\\-_.]/);
95
+ return "variable";
96
+ }
97
+ return null;
98
+ }
99
+
100
+ function bracketed(level, style) {
101
+ return function(stream, state) {
102
+ var curlev = null, ch;
103
+ while ((ch = stream.next()) != null) {
104
+ if (curlev == null) {if (ch == "]") curlev = 0;}
105
+ else if (ch == "=") ++curlev;
106
+ else if (ch == "]" && curlev == level) { state.cur = normal; break; }
107
+ else curlev = null;
108
+ }
109
+ return style;
110
+ };
111
+ }
112
+
113
+ function string(quote) {
114
+ return function(stream, state) {
115
+ var escaped = false, ch;
116
+ while ((ch = stream.next()) != null) {
117
+ if (ch == quote && !escaped) break;
118
+ escaped = !escaped && ch == "\\";
119
+ }
120
+ if (!escaped) state.cur = normal;
121
+ return "string";
122
+ };
123
+ }
124
+
125
+ return {
126
+ startState: function(basecol) {
127
+ return {basecol: basecol || 0, indentDepth: 0, cur: normal};
128
+ },
129
+
130
+ token: function(stream, state) {
131
+ if (stream.eatSpace()) return null;
132
+ var style = state.cur(stream, state);
133
+ var word = stream.current();
134
+ if (style == "variable") {
135
+ if (keywords.test(word)) style = "keyword";
136
+ else if (builtins.test(word)) style = "builtin";
137
+ else if (specials.test(word)) style = "variable-2";
138
+ }
139
+ if ((style != "comment") && (style != "string")){
140
+ if (indentTokens.test(word)) ++state.indentDepth;
141
+ else if (dedentTokens.test(word)) --state.indentDepth;
142
+ }
143
+ return style;
144
+ },
145
+
146
+ indent: function(state, textAfter) {
147
+ var closing = dedentPartial.test(textAfter);
148
+ return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0));
149
+ },
150
+
151
+ lineComment: "--",
152
+ blockCommentStart: "--[[",
153
+ blockCommentEnd: "]]"
154
+ };
155
+ });
156
+
157
+ CodeMirror.defineMIME("text/x-lua", "lua");
158
+
159
+ });
@@ -0,0 +1,884 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror", "../xml/xml", "../meta"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
15
+
16
+ var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
17
+ var htmlModeMissing = htmlMode.name == "null"
18
+
19
+ function getMode(name) {
20
+ if (CodeMirror.findModeByName) {
21
+ var found = CodeMirror.findModeByName(name);
22
+ if (found) name = found.mime || found.mimes[0];
23
+ }
24
+ var mode = CodeMirror.getMode(cmCfg, name);
25
+ return mode.name == "null" ? null : mode;
26
+ }
27
+
28
+ // Should characters that affect highlighting be highlighted separate?
29
+ // Does not include characters that will be output (such as `1.` and `-` for lists)
30
+ if (modeCfg.highlightFormatting === undefined)
31
+ modeCfg.highlightFormatting = false;
32
+
33
+ // Maximum number of nested blockquotes. Set to 0 for infinite nesting.
34
+ // Excess `>` will emit `error` token.
35
+ if (modeCfg.maxBlockquoteDepth === undefined)
36
+ modeCfg.maxBlockquoteDepth = 0;
37
+
38
+ // Turn on task lists? ("- [ ] " and "- [x] ")
39
+ if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
40
+
41
+ // Turn on strikethrough syntax
42
+ if (modeCfg.strikethrough === undefined)
43
+ modeCfg.strikethrough = false;
44
+
45
+ if (modeCfg.emoji === undefined)
46
+ modeCfg.emoji = false;
47
+
48
+ if (modeCfg.fencedCodeBlockHighlighting === undefined)
49
+ modeCfg.fencedCodeBlockHighlighting = true;
50
+
51
+ if (modeCfg.xml === undefined)
52
+ modeCfg.xml = true;
53
+
54
+ // Allow token types to be overridden by user-provided token types.
55
+ if (modeCfg.tokenTypeOverrides === undefined)
56
+ modeCfg.tokenTypeOverrides = {};
57
+
58
+ var tokenTypes = {
59
+ header: "header",
60
+ code: "comment",
61
+ quote: "quote",
62
+ list1: "variable-2",
63
+ list2: "variable-3",
64
+ list3: "keyword",
65
+ hr: "hr",
66
+ image: "image",
67
+ imageAltText: "image-alt-text",
68
+ imageMarker: "image-marker",
69
+ formatting: "formatting",
70
+ linkInline: "link",
71
+ linkEmail: "link",
72
+ linkText: "link",
73
+ linkHref: "string",
74
+ em: "em",
75
+ strong: "strong",
76
+ strikethrough: "strikethrough",
77
+ emoji: "builtin"
78
+ };
79
+
80
+ for (var tokenType in tokenTypes) {
81
+ if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
82
+ tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
83
+ }
84
+ }
85
+
86
+ var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
87
+ , listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/
88
+ , taskListRE = /^\[(x| )\](?=\s)/i // Must follow listRE
89
+ , atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
90
+ , setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
91
+ , textRE = /^[^#!\[\]*_\\<>` "'(~:]+/
92
+ , fencedCodeRE = /^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/
93
+ , linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition
94
+ , punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/
95
+ , expandedTab = " " // CommonMark specifies tab as 4 spaces
96
+
97
+ function switchInline(stream, state, f) {
98
+ state.f = state.inline = f;
99
+ return f(stream, state);
100
+ }
101
+
102
+ function switchBlock(stream, state, f) {
103
+ state.f = state.block = f;
104
+ return f(stream, state);
105
+ }
106
+
107
+ function lineIsEmpty(line) {
108
+ return !line || !/\S/.test(line.string)
109
+ }
110
+
111
+ // Blocks
112
+
113
+ function blankLine(state) {
114
+ // Reset linkTitle state
115
+ state.linkTitle = false;
116
+ state.linkHref = false;
117
+ state.linkText = false;
118
+ // Reset EM state
119
+ state.em = false;
120
+ // Reset STRONG state
121
+ state.strong = false;
122
+ // Reset strikethrough state
123
+ state.strikethrough = false;
124
+ // Reset state.quote
125
+ state.quote = 0;
126
+ // Reset state.indentedCode
127
+ state.indentedCode = false;
128
+ if (state.f == htmlBlock) {
129
+ var exit = htmlModeMissing
130
+ if (!exit) {
131
+ var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
132
+ exit = inner.mode.name == "xml" && inner.state.tagStart === null &&
133
+ (!inner.state.context && inner.state.tokenize.isInText)
134
+ }
135
+ if (exit) {
136
+ state.f = inlineNormal;
137
+ state.block = blockNormal;
138
+ state.htmlState = null;
139
+ }
140
+ }
141
+ // Reset state.trailingSpace
142
+ state.trailingSpace = 0;
143
+ state.trailingSpaceNewLine = false;
144
+ // Mark this line as blank
145
+ state.prevLine = state.thisLine
146
+ state.thisLine = {stream: null}
147
+ return null;
148
+ }
149
+
150
+ function blockNormal(stream, state) {
151
+ var firstTokenOnLine = stream.column() === state.indentation;
152
+ var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
153
+ var prevLineIsIndentedCode = state.indentedCode;
154
+ var prevLineIsHr = state.prevLine.hr;
155
+ var prevLineIsList = state.list !== false;
156
+ var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3;
157
+
158
+ state.indentedCode = false;
159
+
160
+ var lineIndentation = state.indentation;
161
+ // compute once per line (on first token)
162
+ if (state.indentationDiff === null) {
163
+ state.indentationDiff = state.indentation;
164
+ if (prevLineIsList) {
165
+ // Reset inline styles which shouldn't propagate aross list items
166
+ state.em = false;
167
+ state.strong = false;
168
+ state.code = false;
169
+ state.strikethrough = false;
170
+
171
+ state.list = null;
172
+ // While this list item's marker's indentation is less than the deepest
173
+ // list item's content's indentation,pop the deepest list item
174
+ // indentation off the stack, and update block indentation state
175
+ while (lineIndentation < state.listStack[state.listStack.length - 1]) {
176
+ state.listStack.pop();
177
+ if (state.listStack.length) {
178
+ state.indentation = state.listStack[state.listStack.length - 1];
179
+ // less than the first list's indent -> the line is no longer a list
180
+ } else {
181
+ state.list = false;
182
+ }
183
+ }
184
+ if (state.list !== false) {
185
+ state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1]
186
+ }
187
+ }
188
+ }
189
+
190
+ // not comprehensive (currently only for setext detection purposes)
191
+ var allowsInlineContinuation = (
192
+ !prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header &&
193
+ (!prevLineIsList || !prevLineIsIndentedCode) &&
194
+ !state.prevLine.fencedCodeEnd
195
+ );
196
+
197
+ var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) &&
198
+ state.indentation <= maxNonCodeIndentation && stream.match(hrRE);
199
+
200
+ var match = null;
201
+ if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd ||
202
+ state.prevLine.header || prevLineLineIsEmpty)) {
203
+ stream.skipToEnd();
204
+ state.indentedCode = true;
205
+ return tokenTypes.code;
206
+ } else if (stream.eatSpace()) {
207
+ return null;
208
+ } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
209
+ state.quote = 0;
210
+ state.header = match[1].length;
211
+ state.thisLine.header = true;
212
+ if (modeCfg.highlightFormatting) state.formatting = "header";
213
+ state.f = state.inline;
214
+ return getType(state);
215
+ } else if (state.indentation <= maxNonCodeIndentation && stream.eat('>')) {
216
+ state.quote = firstTokenOnLine ? 1 : state.quote + 1;
217
+ if (modeCfg.highlightFormatting) state.formatting = "quote";
218
+ stream.eatSpace();
219
+ return getType(state);
220
+ } else if (!isHr && !state.setext && firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(listRE))) {
221
+ var listType = match[1] ? "ol" : "ul";
222
+
223
+ state.indentation = lineIndentation + stream.current().length;
224
+ state.list = true;
225
+ state.quote = 0;
226
+
227
+ // Add this list item's content's indentation to the stack
228
+ state.listStack.push(state.indentation);
229
+
230
+ if (modeCfg.taskLists && stream.match(taskListRE, false)) {
231
+ state.taskList = true;
232
+ }
233
+ state.f = state.inline;
234
+ if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
235
+ return getType(state);
236
+ } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(fencedCodeRE, true))) {
237
+ state.quote = 0;
238
+ state.fencedEndRE = new RegExp(match[1] + "+ *$");
239
+ // try switching mode
240
+ state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2]);
241
+ if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
242
+ state.f = state.block = local;
243
+ if (modeCfg.highlightFormatting) state.formatting = "code-block";
244
+ state.code = -1
245
+ return getType(state);
246
+ // SETEXT has lowest block-scope precedence after HR, so check it after
247
+ // the others (code, blockquote, list...)
248
+ } else if (
249
+ // if setext set, indicates line after ---/===
250
+ state.setext || (
251
+ // line before ---/===
252
+ (!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false &&
253
+ !state.code && !isHr && !linkDefRE.test(stream.string) &&
254
+ (match = stream.lookAhead(1)) && (match = match.match(setextHeaderRE))
255
+ )
256
+ ) {
257
+ if ( !state.setext ) {
258
+ state.header = match[0].charAt(0) == '=' ? 1 : 2;
259
+ state.setext = state.header;
260
+ } else {
261
+ state.header = state.setext;
262
+ // has no effect on type so we can reset it now
263
+ state.setext = 0;
264
+ stream.skipToEnd();
265
+ if (modeCfg.highlightFormatting) state.formatting = "header";
266
+ }
267
+ state.thisLine.header = true;
268
+ state.f = state.inline;
269
+ return getType(state);
270
+ } else if (isHr) {
271
+ stream.skipToEnd();
272
+ state.hr = true;
273
+ state.thisLine.hr = true;
274
+ return tokenTypes.hr;
275
+ } else if (stream.peek() === '[') {
276
+ return switchInline(stream, state, footnoteLink);
277
+ }
278
+
279
+ return switchInline(stream, state, state.inline);
280
+ }
281
+
282
+ function htmlBlock(stream, state) {
283
+ var style = htmlMode.token(stream, state.htmlState);
284
+ if (!htmlModeMissing) {
285
+ var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
286
+ if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
287
+ (!inner.state.context && inner.state.tokenize.isInText)) ||
288
+ (state.md_inside && stream.current().indexOf(">") > -1)) {
289
+ state.f = inlineNormal;
290
+ state.block = blockNormal;
291
+ state.htmlState = null;
292
+ }
293
+ }
294
+ return style;
295
+ }
296
+
297
+ function local(stream, state) {
298
+ var currListInd = state.listStack[state.listStack.length - 1] || 0;
299
+ var hasExitedList = state.indentation < currListInd;
300
+ var maxFencedEndInd = currListInd + 3;
301
+ if (state.fencedEndRE && state.indentation <= maxFencedEndInd && (hasExitedList || stream.match(state.fencedEndRE))) {
302
+ if (modeCfg.highlightFormatting) state.formatting = "code-block";
303
+ var returnType;
304
+ if (!hasExitedList) returnType = getType(state)
305
+ state.localMode = state.localState = null;
306
+ state.block = blockNormal;
307
+ state.f = inlineNormal;
308
+ state.fencedEndRE = null;
309
+ state.code = 0
310
+ state.thisLine.fencedCodeEnd = true;
311
+ if (hasExitedList) return switchBlock(stream, state, state.block);
312
+ return returnType;
313
+ } else if (state.localMode) {
314
+ return state.localMode.token(stream, state.localState);
315
+ } else {
316
+ stream.skipToEnd();
317
+ return tokenTypes.code;
318
+ }
319
+ }
320
+
321
+ // Inline
322
+ function getType(state) {
323
+ var styles = [];
324
+
325
+ if (state.formatting) {
326
+ styles.push(tokenTypes.formatting);
327
+
328
+ if (typeof state.formatting === "string") state.formatting = [state.formatting];
329
+
330
+ for (var i = 0; i < state.formatting.length; i++) {
331
+ styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
332
+
333
+ if (state.formatting[i] === "header") {
334
+ styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
335
+ }
336
+
337
+ // Add `formatting-quote` and `formatting-quote-#` for blockquotes
338
+ // Add `error` instead if the maximum blockquote nesting depth is passed
339
+ if (state.formatting[i] === "quote") {
340
+ if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
341
+ styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
342
+ } else {
343
+ styles.push("error");
344
+ }
345
+ }
346
+ }
347
+ }
348
+
349
+ if (state.taskOpen) {
350
+ styles.push("meta");
351
+ return styles.length ? styles.join(' ') : null;
352
+ }
353
+ if (state.taskClosed) {
354
+ styles.push("property");
355
+ return styles.length ? styles.join(' ') : null;
356
+ }
357
+
358
+ if (state.linkHref) {
359
+ styles.push(tokenTypes.linkHref, "url");
360
+ } else { // Only apply inline styles to non-url text
361
+ if (state.strong) { styles.push(tokenTypes.strong); }
362
+ if (state.em) { styles.push(tokenTypes.em); }
363
+ if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
364
+ if (state.emoji) { styles.push(tokenTypes.emoji); }
365
+ if (state.linkText) { styles.push(tokenTypes.linkText); }
366
+ if (state.code) { styles.push(tokenTypes.code); }
367
+ if (state.image) { styles.push(tokenTypes.image); }
368
+ if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); }
369
+ if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }
370
+ }
371
+
372
+ if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
373
+
374
+ if (state.quote) {
375
+ styles.push(tokenTypes.quote);
376
+
377
+ // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
378
+ if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
379
+ styles.push(tokenTypes.quote + "-" + state.quote);
380
+ } else {
381
+ styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
382
+ }
383
+ }
384
+
385
+ if (state.list !== false) {
386
+ var listMod = (state.listStack.length - 1) % 3;
387
+ if (!listMod) {
388
+ styles.push(tokenTypes.list1);
389
+ } else if (listMod === 1) {
390
+ styles.push(tokenTypes.list2);
391
+ } else {
392
+ styles.push(tokenTypes.list3);
393
+ }
394
+ }
395
+
396
+ if (state.trailingSpaceNewLine) {
397
+ styles.push("trailing-space-new-line");
398
+ } else if (state.trailingSpace) {
399
+ styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
400
+ }
401
+
402
+ return styles.length ? styles.join(' ') : null;
403
+ }
404
+
405
+ function handleText(stream, state) {
406
+ if (stream.match(textRE, true)) {
407
+ return getType(state);
408
+ }
409
+ return undefined;
410
+ }
411
+
412
+ function inlineNormal(stream, state) {
413
+ var style = state.text(stream, state);
414
+ if (typeof style !== 'undefined')
415
+ return style;
416
+
417
+ if (state.list) { // List marker (*, +, -, 1., etc)
418
+ state.list = null;
419
+ return getType(state);
420
+ }
421
+
422
+ if (state.taskList) {
423
+ var taskOpen = stream.match(taskListRE, true)[1] === " ";
424
+ if (taskOpen) state.taskOpen = true;
425
+ else state.taskClosed = true;
426
+ if (modeCfg.highlightFormatting) state.formatting = "task";
427
+ state.taskList = false;
428
+ return getType(state);
429
+ }
430
+
431
+ state.taskOpen = false;
432
+ state.taskClosed = false;
433
+
434
+ if (state.header && stream.match(/^#+$/, true)) {
435
+ if (modeCfg.highlightFormatting) state.formatting = "header";
436
+ return getType(state);
437
+ }
438
+
439
+ var ch = stream.next();
440
+
441
+ // Matches link titles present on next line
442
+ if (state.linkTitle) {
443
+ state.linkTitle = false;
444
+ var matchCh = ch;
445
+ if (ch === '(') {
446
+ matchCh = ')';
447
+ }
448
+ matchCh = (matchCh+'').replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
449
+ var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
450
+ if (stream.match(new RegExp(regex), true)) {
451
+ return tokenTypes.linkHref;
452
+ }
453
+ }
454
+
455
+ // If this block is changed, it may need to be updated in GFM mode
456
+ if (ch === '`') {
457
+ var previousFormatting = state.formatting;
458
+ if (modeCfg.highlightFormatting) state.formatting = "code";
459
+ stream.eatWhile('`');
460
+ var count = stream.current().length
461
+ if (state.code == 0 && (!state.quote || count == 1)) {
462
+ state.code = count
463
+ return getType(state)
464
+ } else if (count == state.code) { // Must be exact
465
+ var t = getType(state)
466
+ state.code = 0
467
+ return t
468
+ } else {
469
+ state.formatting = previousFormatting
470
+ return getType(state)
471
+ }
472
+ } else if (state.code) {
473
+ return getType(state);
474
+ }
475
+
476
+ if (ch === '\\') {
477
+ stream.next();
478
+ if (modeCfg.highlightFormatting) {
479
+ var type = getType(state);
480
+ var formattingEscape = tokenTypes.formatting + "-escape";
481
+ return type ? type + " " + formattingEscape : formattingEscape;
482
+ }
483
+ }
484
+
485
+ if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
486
+ state.imageMarker = true;
487
+ state.image = true;
488
+ if (modeCfg.highlightFormatting) state.formatting = "image";
489
+ return getType(state);
490
+ }
491
+
492
+ if (ch === '[' && state.imageMarker && stream.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/, false)) {
493
+ state.imageMarker = false;
494
+ state.imageAltText = true
495
+ if (modeCfg.highlightFormatting) state.formatting = "image";
496
+ return getType(state);
497
+ }
498
+
499
+ if (ch === ']' && state.imageAltText) {
500
+ if (modeCfg.highlightFormatting) state.formatting = "image";
501
+ var type = getType(state);
502
+ state.imageAltText = false;
503
+ state.image = false;
504
+ state.inline = state.f = linkHref;
505
+ return type;
506
+ }
507
+
508
+ if (ch === '[' && !state.image) {
509
+ if (state.linkText && stream.match(/^.*?\]/)) return getType(state)
510
+ state.linkText = true;
511
+ if (modeCfg.highlightFormatting) state.formatting = "link";
512
+ return getType(state);
513
+ }
514
+
515
+ if (ch === ']' && state.linkText) {
516
+ if (modeCfg.highlightFormatting) state.formatting = "link";
517
+ var type = getType(state);
518
+ state.linkText = false;
519
+ state.inline = state.f = stream.match(/\(.*?\)| ?\[.*?\]/, false) ? linkHref : inlineNormal
520
+ return type;
521
+ }
522
+
523
+ if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
524
+ state.f = state.inline = linkInline;
525
+ if (modeCfg.highlightFormatting) state.formatting = "link";
526
+ var type = getType(state);
527
+ if (type){
528
+ type += " ";
529
+ } else {
530
+ type = "";
531
+ }
532
+ return type + tokenTypes.linkInline;
533
+ }
534
+
535
+ if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
536
+ state.f = state.inline = linkInline;
537
+ if (modeCfg.highlightFormatting) state.formatting = "link";
538
+ var type = getType(state);
539
+ if (type){
540
+ type += " ";
541
+ } else {
542
+ type = "";
543
+ }
544
+ return type + tokenTypes.linkEmail;
545
+ }
546
+
547
+ if (modeCfg.xml && ch === '<' && stream.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i, false)) {
548
+ var end = stream.string.indexOf(">", stream.pos);
549
+ if (end != -1) {
550
+ var atts = stream.string.substring(stream.start, end);
551
+ if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
552
+ }
553
+ stream.backUp(1);
554
+ state.htmlState = CodeMirror.startState(htmlMode);
555
+ return switchBlock(stream, state, htmlBlock);
556
+ }
557
+
558
+ if (modeCfg.xml && ch === '<' && stream.match(/^\/\w*?>/)) {
559
+ state.md_inside = false;
560
+ return "tag";
561
+ } else if (ch === "*" || ch === "_") {
562
+ var len = 1, before = stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2)
563
+ while (len < 3 && stream.eat(ch)) len++
564
+ var after = stream.peek() || " "
565
+ // See http://spec.commonmark.org/0.27/#emphasis-and-strong-emphasis
566
+ var leftFlanking = !/\s/.test(after) && (!punctuation.test(after) || /\s/.test(before) || punctuation.test(before))
567
+ var rightFlanking = !/\s/.test(before) && (!punctuation.test(before) || /\s/.test(after) || punctuation.test(after))
568
+ var setEm = null, setStrong = null
569
+ if (len % 2) { // Em
570
+ if (!state.em && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
571
+ setEm = true
572
+ else if (state.em == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
573
+ setEm = false
574
+ }
575
+ if (len > 1) { // Strong
576
+ if (!state.strong && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
577
+ setStrong = true
578
+ else if (state.strong == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
579
+ setStrong = false
580
+ }
581
+ if (setStrong != null || setEm != null) {
582
+ if (modeCfg.highlightFormatting) state.formatting = setEm == null ? "strong" : setStrong == null ? "em" : "strong em"
583
+ if (setEm === true) state.em = ch
584
+ if (setStrong === true) state.strong = ch
585
+ var t = getType(state)
586
+ if (setEm === false) state.em = false
587
+ if (setStrong === false) state.strong = false
588
+ return t
589
+ }
590
+ } else if (ch === ' ') {
591
+ if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
592
+ if (stream.peek() === ' ') { // Surrounded by spaces, ignore
593
+ return getType(state);
594
+ } else { // Not surrounded by spaces, back up pointer
595
+ stream.backUp(1);
596
+ }
597
+ }
598
+ }
599
+
600
+ if (modeCfg.strikethrough) {
601
+ if (ch === '~' && stream.eatWhile(ch)) {
602
+ if (state.strikethrough) {// Remove strikethrough
603
+ if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
604
+ var t = getType(state);
605
+ state.strikethrough = false;
606
+ return t;
607
+ } else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
608
+ state.strikethrough = true;
609
+ if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
610
+ return getType(state);
611
+ }
612
+ } else if (ch === ' ') {
613
+ if (stream.match(/^~~/, true)) { // Probably surrounded by space
614
+ if (stream.peek() === ' ') { // Surrounded by spaces, ignore
615
+ return getType(state);
616
+ } else { // Not surrounded by spaces, back up pointer
617
+ stream.backUp(2);
618
+ }
619
+ }
620
+ }
621
+ }
622
+
623
+ if (modeCfg.emoji && ch === ":" && stream.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)) {
624
+ state.emoji = true;
625
+ if (modeCfg.highlightFormatting) state.formatting = "emoji";
626
+ var retType = getType(state);
627
+ state.emoji = false;
628
+ return retType;
629
+ }
630
+
631
+ if (ch === ' ') {
632
+ if (stream.match(/^ +$/, false)) {
633
+ state.trailingSpace++;
634
+ } else if (state.trailingSpace) {
635
+ state.trailingSpaceNewLine = true;
636
+ }
637
+ }
638
+
639
+ return getType(state);
640
+ }
641
+
642
+ function linkInline(stream, state) {
643
+ var ch = stream.next();
644
+
645
+ if (ch === ">") {
646
+ state.f = state.inline = inlineNormal;
647
+ if (modeCfg.highlightFormatting) state.formatting = "link";
648
+ var type = getType(state);
649
+ if (type){
650
+ type += " ";
651
+ } else {
652
+ type = "";
653
+ }
654
+ return type + tokenTypes.linkInline;
655
+ }
656
+
657
+ stream.match(/^[^>]+/, true);
658
+
659
+ return tokenTypes.linkInline;
660
+ }
661
+
662
+ function linkHref(stream, state) {
663
+ // Check if space, and return NULL if so (to avoid marking the space)
664
+ if(stream.eatSpace()){
665
+ return null;
666
+ }
667
+ var ch = stream.next();
668
+ if (ch === '(' || ch === '[') {
669
+ state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
670
+ if (modeCfg.highlightFormatting) state.formatting = "link-string";
671
+ state.linkHref = true;
672
+ return getType(state);
673
+ }
674
+ return 'error';
675
+ }
676
+
677
+ var linkRE = {
678
+ ")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
679
+ "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/
680
+ }
681
+
682
+ function getLinkHrefInside(endChar) {
683
+ return function(stream, state) {
684
+ var ch = stream.next();
685
+
686
+ if (ch === endChar) {
687
+ state.f = state.inline = inlineNormal;
688
+ if (modeCfg.highlightFormatting) state.formatting = "link-string";
689
+ var returnState = getType(state);
690
+ state.linkHref = false;
691
+ return returnState;
692
+ }
693
+
694
+ stream.match(linkRE[endChar])
695
+ state.linkHref = true;
696
+ return getType(state);
697
+ };
698
+ }
699
+
700
+ function footnoteLink(stream, state) {
701
+ if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
702
+ state.f = footnoteLinkInside;
703
+ stream.next(); // Consume [
704
+ if (modeCfg.highlightFormatting) state.formatting = "link";
705
+ state.linkText = true;
706
+ return getType(state);
707
+ }
708
+ return switchInline(stream, state, inlineNormal);
709
+ }
710
+
711
+ function footnoteLinkInside(stream, state) {
712
+ if (stream.match(/^\]:/, true)) {
713
+ state.f = state.inline = footnoteUrl;
714
+ if (modeCfg.highlightFormatting) state.formatting = "link";
715
+ var returnType = getType(state);
716
+ state.linkText = false;
717
+ return returnType;
718
+ }
719
+
720
+ stream.match(/^([^\]\\]|\\.)+/, true);
721
+
722
+ return tokenTypes.linkText;
723
+ }
724
+
725
+ function footnoteUrl(stream, state) {
726
+ // Check if space, and return NULL if so (to avoid marking the space)
727
+ if(stream.eatSpace()){
728
+ return null;
729
+ }
730
+ // Match URL
731
+ stream.match(/^[^\s]+/, true);
732
+ // Check for link title
733
+ if (stream.peek() === undefined) { // End of line, set flag to check next line
734
+ state.linkTitle = true;
735
+ } else { // More content on line, check if link title
736
+ stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
737
+ }
738
+ state.f = state.inline = inlineNormal;
739
+ return tokenTypes.linkHref + " url";
740
+ }
741
+
742
+ var mode = {
743
+ startState: function() {
744
+ return {
745
+ f: blockNormal,
746
+
747
+ prevLine: {stream: null},
748
+ thisLine: {stream: null},
749
+
750
+ block: blockNormal,
751
+ htmlState: null,
752
+ indentation: 0,
753
+
754
+ inline: inlineNormal,
755
+ text: handleText,
756
+
757
+ formatting: false,
758
+ linkText: false,
759
+ linkHref: false,
760
+ linkTitle: false,
761
+ code: 0,
762
+ em: false,
763
+ strong: false,
764
+ header: 0,
765
+ setext: 0,
766
+ hr: false,
767
+ taskList: false,
768
+ list: false,
769
+ listStack: [],
770
+ quote: 0,
771
+ trailingSpace: 0,
772
+ trailingSpaceNewLine: false,
773
+ strikethrough: false,
774
+ emoji: false,
775
+ fencedEndRE: null
776
+ };
777
+ },
778
+
779
+ copyState: function(s) {
780
+ return {
781
+ f: s.f,
782
+
783
+ prevLine: s.prevLine,
784
+ thisLine: s.thisLine,
785
+
786
+ block: s.block,
787
+ htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
788
+ indentation: s.indentation,
789
+
790
+ localMode: s.localMode,
791
+ localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
792
+
793
+ inline: s.inline,
794
+ text: s.text,
795
+ formatting: false,
796
+ linkText: s.linkText,
797
+ linkTitle: s.linkTitle,
798
+ linkHref: s.linkHref,
799
+ code: s.code,
800
+ em: s.em,
801
+ strong: s.strong,
802
+ strikethrough: s.strikethrough,
803
+ emoji: s.emoji,
804
+ header: s.header,
805
+ setext: s.setext,
806
+ hr: s.hr,
807
+ taskList: s.taskList,
808
+ list: s.list,
809
+ listStack: s.listStack.slice(0),
810
+ quote: s.quote,
811
+ indentedCode: s.indentedCode,
812
+ trailingSpace: s.trailingSpace,
813
+ trailingSpaceNewLine: s.trailingSpaceNewLine,
814
+ md_inside: s.md_inside,
815
+ fencedEndRE: s.fencedEndRE
816
+ };
817
+ },
818
+
819
+ token: function(stream, state) {
820
+
821
+ // Reset state.formatting
822
+ state.formatting = false;
823
+
824
+ if (stream != state.thisLine.stream) {
825
+ state.header = 0;
826
+ state.hr = false;
827
+
828
+ if (stream.match(/^\s*$/, true)) {
829
+ blankLine(state);
830
+ return null;
831
+ }
832
+
833
+ state.prevLine = state.thisLine
834
+ state.thisLine = {stream: stream}
835
+
836
+ // Reset state.taskList
837
+ state.taskList = false;
838
+
839
+ // Reset state.trailingSpace
840
+ state.trailingSpace = 0;
841
+ state.trailingSpaceNewLine = false;
842
+
843
+ if (!state.localState) {
844
+ state.f = state.block;
845
+ if (state.f != htmlBlock) {
846
+ var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, expandedTab).length;
847
+ state.indentation = indentation;
848
+ state.indentationDiff = null;
849
+ if (indentation > 0) return null;
850
+ }
851
+ }
852
+ }
853
+ return state.f(stream, state);
854
+ },
855
+
856
+ innerMode: function(state) {
857
+ if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};
858
+ if (state.localState) return {state: state.localState, mode: state.localMode};
859
+ return {state: state, mode: mode};
860
+ },
861
+
862
+ indent: function(state, textAfter, line) {
863
+ if (state.block == htmlBlock && htmlMode.indent) return htmlMode.indent(state.htmlState, textAfter, line)
864
+ if (state.localState && state.localMode.indent) return state.localMode.indent(state.localState, textAfter, line)
865
+ return CodeMirror.Pass
866
+ },
867
+
868
+ blankLine: blankLine,
869
+
870
+ getType: getType,
871
+
872
+ blockCommentStart: "<!--",
873
+ blockCommentEnd: "-->",
874
+ closeBrackets: "()[]{}''\"\"``",
875
+ fold: "markdown"
876
+ };
877
+ return mode;
878
+ }, "xml");
879
+
880
+ CodeMirror.defineMIME("text/markdown", "markdown");
881
+
882
+ CodeMirror.defineMIME("text/x-markdown", "markdown");
883
+
884
+ });