markdown.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. "use strict";
  2. /*!-----------------------------------------------------------------------------
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  5. * Released under the MIT license
  6. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  7. *-----------------------------------------------------------------------------*/
  8. define("vs/basic-languages/markdown/markdown", ["require"],(require)=>{
  9. var moduleExports = (() => {
  10. var __defProp = Object.defineProperty;
  11. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  12. var __getOwnPropNames = Object.getOwnPropertyNames;
  13. var __hasOwnProp = Object.prototype.hasOwnProperty;
  14. var __export = (target, all) => {
  15. for (var name in all)
  16. __defProp(target, name, { get: all[name], enumerable: true });
  17. };
  18. var __copyProps = (to, from, except, desc) => {
  19. if (from && typeof from === "object" || typeof from === "function") {
  20. for (let key of __getOwnPropNames(from))
  21. if (!__hasOwnProp.call(to, key) && key !== except)
  22. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  23. }
  24. return to;
  25. };
  26. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  27. // src/basic-languages/markdown/markdown.ts
  28. var markdown_exports = {};
  29. __export(markdown_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. comments: {
  35. blockComment: ["<!--", "-->"]
  36. },
  37. brackets: [
  38. ["{", "}"],
  39. ["[", "]"],
  40. ["(", ")"]
  41. ],
  42. autoClosingPairs: [
  43. { open: "{", close: "}" },
  44. { open: "[", close: "]" },
  45. { open: "(", close: ")" },
  46. { open: "<", close: ">", notIn: ["string"] }
  47. ],
  48. surroundingPairs: [
  49. { open: "(", close: ")" },
  50. { open: "[", close: "]" },
  51. { open: "`", close: "`" }
  52. ],
  53. folding: {
  54. markers: {
  55. start: new RegExp("^\\s*<!--\\s*#?region\\b.*-->"),
  56. end: new RegExp("^\\s*<!--\\s*#?endregion\\b.*-->")
  57. }
  58. }
  59. };
  60. var language = {
  61. defaultToken: "",
  62. tokenPostfix: ".md",
  63. control: /[\\`*_\[\]{}()#+\-\.!]/,
  64. noncontrol: /[^\\`*_\[\]{}()#+\-\.!]/,
  65. escapes: /\\(?:@control)/,
  66. jsescapes: /\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,
  67. empty: [
  68. "area",
  69. "base",
  70. "basefont",
  71. "br",
  72. "col",
  73. "frame",
  74. "hr",
  75. "img",
  76. "input",
  77. "isindex",
  78. "link",
  79. "meta",
  80. "param"
  81. ],
  82. tokenizer: {
  83. root: [
  84. [/^\s*\|/, "@rematch", "@table_header"],
  85. [/^(\s{0,3})(#+)((?:[^\\#]|@escapes)+)((?:#+)?)/, ["white", "keyword", "keyword", "keyword"]],
  86. [/^\s*(=+|\-+)\s*$/, "keyword"],
  87. [/^\s*((\*[ ]?)+)\s*$/, "meta.separator"],
  88. [/^\s*>+/, "comment"],
  89. [/^\s*([\*\-+:]|\d+\.)\s/, "keyword"],
  90. [/^(\t|[ ]{4})[^ ].*$/, "string"],
  91. [/^\s*~~~\s*((?:\w|[\/\-#])+)?\s*$/, { token: "string", next: "@codeblock" }],
  92. [
  93. /^\s*```\s*((?:\w|[\/\-#])+).*$/,
  94. { token: "string", next: "@codeblockgh", nextEmbedded: "$1" }
  95. ],
  96. [/^\s*```\s*$/, { token: "string", next: "@codeblock" }],
  97. { include: "@linecontent" }
  98. ],
  99. table_header: [
  100. { include: "@table_common" },
  101. [/[^\|]+/, "keyword.table.header"]
  102. ],
  103. table_body: [{ include: "@table_common" }, { include: "@linecontent" }],
  104. table_common: [
  105. [/\s*[\-:]+\s*/, { token: "keyword", switchTo: "table_body" }],
  106. [/^\s*\|/, "keyword.table.left"],
  107. [/^\s*[^\|]/, "@rematch", "@pop"],
  108. [/^\s*$/, "@rematch", "@pop"],
  109. [
  110. /\|/,
  111. {
  112. cases: {
  113. "@eos": "keyword.table.right",
  114. "@default": "keyword.table.middle"
  115. }
  116. }
  117. ]
  118. ],
  119. codeblock: [
  120. [/^\s*~~~\s*$/, { token: "string", next: "@pop" }],
  121. [/^\s*```\s*$/, { token: "string", next: "@pop" }],
  122. [/.*$/, "variable.source"]
  123. ],
  124. codeblockgh: [
  125. [/```\s*$/, { token: "string", next: "@pop", nextEmbedded: "@pop" }],
  126. [/[^`]+/, "variable.source"]
  127. ],
  128. linecontent: [
  129. [/&\w+;/, "string.escape"],
  130. [/@escapes/, "escape"],
  131. [/\b__([^\\_]|@escapes|_(?!_))+__\b/, "strong"],
  132. [/\*\*([^\\*]|@escapes|\*(?!\*))+\*\*/, "strong"],
  133. [/\b_[^_]+_\b/, "emphasis"],
  134. [/\*([^\\*]|@escapes)+\*/, "emphasis"],
  135. [/`([^\\`]|@escapes)+`/, "variable"],
  136. [/\{+[^}]+\}+/, "string.target"],
  137. [/(!?\[)((?:[^\]\\]|@escapes)*)(\]\([^\)]+\))/, ["string.link", "", "string.link"]],
  138. [/(!?\[)((?:[^\]\\]|@escapes)*)(\])/, "string.link"],
  139. { include: "html" }
  140. ],
  141. html: [
  142. [/<(\w+)\/>/, "tag"],
  143. [
  144. /<(\w+)(\-|\w)*/,
  145. {
  146. cases: {
  147. "@empty": { token: "tag", next: "@tag.$1" },
  148. "@default": { token: "tag", next: "@tag.$1" }
  149. }
  150. }
  151. ],
  152. [/<\/(\w+)(\-|\w)*\s*>/, { token: "tag" }],
  153. [/<!--/, "comment", "@comment"]
  154. ],
  155. comment: [
  156. [/[^<\-]+/, "comment.content"],
  157. [/-->/, "comment", "@pop"],
  158. [/<!--/, "comment.content.invalid"],
  159. [/[<\-]/, "comment.content"]
  160. ],
  161. tag: [
  162. [/[ \t\r\n]+/, "white"],
  163. [
  164. /(type)(\s*=\s*)(")([^"]+)(")/,
  165. [
  166. "attribute.name.html",
  167. "delimiter.html",
  168. "string.html",
  169. { token: "string.html", switchTo: "@tag.$S2.$4" },
  170. "string.html"
  171. ]
  172. ],
  173. [
  174. /(type)(\s*=\s*)(')([^']+)(')/,
  175. [
  176. "attribute.name.html",
  177. "delimiter.html",
  178. "string.html",
  179. { token: "string.html", switchTo: "@tag.$S2.$4" },
  180. "string.html"
  181. ]
  182. ],
  183. [/(\w+)(\s*=\s*)("[^"]*"|'[^']*')/, ["attribute.name.html", "delimiter.html", "string.html"]],
  184. [/\w+/, "attribute.name.html"],
  185. [/\/>/, "tag", "@pop"],
  186. [
  187. />/,
  188. {
  189. cases: {
  190. "$S2==style": {
  191. token: "tag",
  192. switchTo: "embeddedStyle",
  193. nextEmbedded: "text/css"
  194. },
  195. "$S2==script": {
  196. cases: {
  197. $S3: {
  198. token: "tag",
  199. switchTo: "embeddedScript",
  200. nextEmbedded: "$S3"
  201. },
  202. "@default": {
  203. token: "tag",
  204. switchTo: "embeddedScript",
  205. nextEmbedded: "text/javascript"
  206. }
  207. }
  208. },
  209. "@default": { token: "tag", next: "@pop" }
  210. }
  211. }
  212. ]
  213. ],
  214. embeddedStyle: [
  215. [/[^<]+/, ""],
  216. [/<\/style\s*>/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }],
  217. [/</, ""]
  218. ],
  219. embeddedScript: [
  220. [/[^<]+/, ""],
  221. [/<\/script\s*>/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }],
  222. [/</, ""]
  223. ]
  224. }
  225. };
  226. return __toCommonJS(markdown_exports);
  227. })();
  228. return moduleExports;
  229. });