hermium 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/README.md +56 -0
  2. package/bin/hermium.mjs +185 -164
  3. package/dist/api.mjs +3513 -0
  4. package/dist/public/assets/css/index-Dfs9RUU9.css +1 -0
  5. package/dist/public/assets/css/styles-B8p6jk5Z.css +1 -0
  6. package/dist/public/assets/js/ChatInputBlock-Bw7AL70H.js +1 -0
  7. package/dist/public/assets/js/MarkdownMessage-8d7Y6VL-.js +1 -0
  8. package/dist/public/assets/js/base-ui-BvQbAt_1.js +1 -0
  9. package/dist/public/assets/js/chat._sessionId-BG6lVraH.js +1 -0
  10. package/dist/public/assets/js/chat.index-D2zdMPTT.js +1 -0
  11. package/dist/public/assets/js/index-C0AK45FU.js +60 -0
  12. package/dist/public/assets/js/index-Cx5En4FK.js +1 -0
  13. package/dist/public/assets/js/memory-CeSRdTkW.js +3 -0
  14. package/dist/public/assets/js/router-8uDKazL-.js +1 -0
  15. package/dist/public/assets/js/settings-Bc3Y5zXO.js +1 -0
  16. package/dist/public/assets/js/skills-DZv7sA_5.js +1 -0
  17. package/dist/public/assets/js/theme-CPkdkpaj.js +1 -0
  18. package/dist/public/assets/js/usage-DXQsT9_b.js +1 -0
  19. package/dist/public/assets/woff2/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  20. package/dist/public/assets/woff2/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  21. package/dist/public/assets/woff2/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  22. package/dist/public/assets/woff2/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  23. package/dist/public/assets/woff2/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  24. package/dist/public/favicon.ico +0 -0
  25. package/dist/public/logo.png +0 -0
  26. package/package.json +1 -1
  27. package/dist/public/assets/IconAlertCircle-BHkmI3j7.js +0 -1
  28. package/dist/public/assets/IconAlertTriangle-wCJudlVg.js +0 -1
  29. package/dist/public/assets/IconCheck-CFuEh_p7.js +0 -1
  30. package/dist/public/assets/IconLoader2-BIx3OuF9.js +0 -1
  31. package/dist/public/assets/IconRefresh-Dgm93w3T.js +0 -1
  32. package/dist/public/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
  33. package/dist/public/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
  34. package/dist/public/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
  35. package/dist/public/assets/index-Bbz3abmO.js +0 -14
  36. package/dist/public/assets/index-CWUaRwcE.js +0 -1
  37. package/dist/public/assets/index-CinLq3cd.js +0 -1
  38. package/dist/public/assets/index-CrQs9n6q.js +0 -29
  39. package/dist/public/assets/index-CtacpN3I.js +0 -1
  40. package/dist/public/assets/index-DY7aE-9s.js +0 -2
  41. package/dist/public/assets/index-DkYGodJj.js +0 -94
  42. package/dist/public/assets/index-DvDLadUx.js +0 -1
  43. package/dist/public/assets/index-U6RcWedt.js +0 -1
  44. package/dist/public/assets/index-_6iFZ0fh.js +0 -1
  45. package/dist/public/assets/index-enFS26SU.js +0 -1
  46. package/dist/public/assets/input-eNcwlDHp.js +0 -1
  47. package/dist/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  48. package/dist/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  49. package/dist/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  50. package/dist/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  51. package/dist/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  52. package/dist/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  53. package/dist/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  54. package/dist/public/assets/queries-iHRgZzw2.js +0 -1
  55. package/dist/public/assets/styles-KcflDlA_.css +0 -1
  56. package/dist/public/assets/switch-B1DcZLwL.js +0 -1
  57. package/dist/public/assets/syntax-highlighter-DWPF-A_h.js +0 -6
  58. package/dist/public/assets/textarea-Di_syYTS.js +0 -1
  59. package/dist/public/favicon.png +0 -0
  60. package/dist/public/nous-logo.png +0 -0
  61. package/dist/server/index.mjs +0 -244
  62. package/dist/web-server/__23tanstack-start-plugin-adapters-Cwee5PKy.mjs +0 -6
  63. package/dist/web-server/_chunks/ssr-renderer.mjs +0 -22
  64. package/dist/web-server/_libs/babel__runtime.mjs +0 -237
  65. package/dist/web-server/_libs/bail.mjs +0 -8
  66. package/dist/web-server/_libs/base-ui__react.mjs +0 -9554
  67. package/dist/web-server/_libs/base-ui__utils.mjs +0 -1101
  68. package/dist/web-server/_libs/ccount.mjs +0 -16
  69. package/dist/web-server/_libs/character-entities-legacy.mjs +0 -111
  70. package/dist/web-server/_libs/character-entities.mjs +0 -2130
  71. package/dist/web-server/_libs/character-reference-invalid.mjs +0 -33
  72. package/dist/web-server/_libs/class-variance-authority.mjs +0 -44
  73. package/dist/web-server/_libs/clsx.mjs +0 -16
  74. package/dist/web-server/_libs/comma-separated-tokens.mjs +0 -31
  75. package/dist/web-server/_libs/cookie-es.mjs +0 -44
  76. package/dist/web-server/_libs/croner.mjs +0 -1
  77. package/dist/web-server/_libs/crossws.mjs +0 -1
  78. package/dist/web-server/_libs/decode-named-character-reference+[...].mjs +0 -8
  79. package/dist/web-server/_libs/devlop.mjs +0 -8
  80. package/dist/web-server/_libs/escape-string-regexp.mjs +0 -9
  81. package/dist/web-server/_libs/estree-util-is-identifier-name.mjs +0 -11
  82. package/dist/web-server/_libs/extend.mjs +0 -97
  83. package/dist/web-server/_libs/fault.mjs +0 -1
  84. package/dist/web-server/_libs/floating-ui__core.mjs +0 -663
  85. package/dist/web-server/_libs/floating-ui__dom.mjs +0 -624
  86. package/dist/web-server/_libs/floating-ui__react-dom.mjs +0 -279
  87. package/dist/web-server/_libs/floating-ui__utils.mjs +0 -322
  88. package/dist/web-server/_libs/format.mjs +0 -1
  89. package/dist/web-server/_libs/h3.mjs +0 -408
  90. package/dist/web-server/_libs/hast-util-parse-selector.mjs +0 -39
  91. package/dist/web-server/_libs/hast-util-to-jsx-runtime.mjs +0 -388
  92. package/dist/web-server/_libs/hast-util-whitespace.mjs +0 -10
  93. package/dist/web-server/_libs/hastscript.mjs +0 -200
  94. package/dist/web-server/_libs/highlight.js.mjs +0 -1
  95. package/dist/web-server/_libs/hookable.mjs +0 -1
  96. package/dist/web-server/_libs/html-url-attributes.mjs +0 -26
  97. package/dist/web-server/_libs/inline-style-parser.mjs +0 -142
  98. package/dist/web-server/_libs/is-alphabetical.mjs +0 -7
  99. package/dist/web-server/_libs/is-alphanumerical.mjs +0 -8
  100. package/dist/web-server/_libs/is-decimal.mjs +0 -7
  101. package/dist/web-server/_libs/is-hexadecimal.mjs +0 -7
  102. package/dist/web-server/_libs/is-plain-obj.mjs +0 -10
  103. package/dist/web-server/_libs/isbot.mjs +0 -21
  104. package/dist/web-server/_libs/longest-streak.mjs +0 -25
  105. package/dist/web-server/_libs/lowlight.mjs +0 -1
  106. package/dist/web-server/_libs/markdown-table.mjs +0 -142
  107. package/dist/web-server/_libs/mdast-util-find-and-replace.mjs +0 -109
  108. package/dist/web-server/_libs/mdast-util-from-markdown.mjs +0 -717
  109. package/dist/web-server/_libs/mdast-util-gfm-autolink-literal+[...].mjs +0 -156
  110. package/dist/web-server/_libs/mdast-util-gfm-footnote.mjs +0 -117
  111. package/dist/web-server/_libs/mdast-util-gfm-strikethrough.mjs +0 -54
  112. package/dist/web-server/_libs/mdast-util-gfm-table.mjs +0 -157
  113. package/dist/web-server/_libs/mdast-util-gfm-task-list-item.mjs +0 -77
  114. package/dist/web-server/_libs/mdast-util-gfm.mjs +0 -29
  115. package/dist/web-server/_libs/mdast-util-phrasing.mjs +0 -30
  116. package/dist/web-server/_libs/mdast-util-to-hast.mjs +0 -710
  117. package/dist/web-server/_libs/mdast-util-to-markdown.mjs +0 -798
  118. package/dist/web-server/_libs/mdast-util-to-string.mjs +0 -38
  119. package/dist/web-server/_libs/micromark-core-commonmark.mjs +0 -2259
  120. package/dist/web-server/_libs/micromark-extension-gfm-autolink-literal+[...].mjs +0 -344
  121. package/dist/web-server/_libs/micromark-extension-gfm-footnote+[...].mjs +0 -279
  122. package/dist/web-server/_libs/micromark-extension-gfm-strikethrough+[...].mjs +0 -98
  123. package/dist/web-server/_libs/micromark-extension-gfm-table.mjs +0 -491
  124. package/dist/web-server/_libs/micromark-extension-gfm-tagfilter+[...].mjs +0 -1
  125. package/dist/web-server/_libs/micromark-extension-gfm-task-list-item+[...].mjs +0 -77
  126. package/dist/web-server/_libs/micromark-extension-gfm.mjs +0 -18
  127. package/dist/web-server/_libs/micromark-factory-destination.mjs +0 -94
  128. package/dist/web-server/_libs/micromark-factory-label.mjs +0 -63
  129. package/dist/web-server/_libs/micromark-factory-space.mjs +0 -24
  130. package/dist/web-server/_libs/micromark-factory-title.mjs +0 -65
  131. package/dist/web-server/_libs/micromark-factory-whitespace.mjs +0 -22
  132. package/dist/web-server/_libs/micromark-util-character.mjs +0 -44
  133. package/dist/web-server/_libs/micromark-util-chunked.mjs +0 -36
  134. package/dist/web-server/_libs/micromark-util-classify-character+[...].mjs +0 -12
  135. package/dist/web-server/_libs/micromark-util-combine-extensions+[...].mjs +0 -41
  136. package/dist/web-server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +0 -19
  137. package/dist/web-server/_libs/micromark-util-decode-string.mjs +0 -21
  138. package/dist/web-server/_libs/micromark-util-encode.mjs +0 -1
  139. package/dist/web-server/_libs/micromark-util-html-tag-name.mjs +0 -69
  140. package/dist/web-server/_libs/micromark-util-normalize-identifier+[...].mjs +0 -6
  141. package/dist/web-server/_libs/micromark-util-resolve-all.mjs +0 -15
  142. package/dist/web-server/_libs/micromark-util-sanitize-uri.mjs +0 -41
  143. package/dist/web-server/_libs/micromark-util-subtokenize.mjs +0 -346
  144. package/dist/web-server/_libs/micromark.mjs +0 -906
  145. package/dist/web-server/_libs/ocache.mjs +0 -1
  146. package/dist/web-server/_libs/ohash.mjs +0 -1
  147. package/dist/web-server/_libs/parse-entities.mjs +0 -245
  148. package/dist/web-server/_libs/property-information.mjs +0 -1210
  149. package/dist/web-server/_libs/react-dom.mjs +0 -10779
  150. package/dist/web-server/_libs/react-markdown.mjs +0 -147
  151. package/dist/web-server/_libs/react-syntax-highlighter.mjs +0 -941
  152. package/dist/web-server/_libs/react.mjs +0 -513
  153. package/dist/web-server/_libs/refractor.mjs +0 -2425
  154. package/dist/web-server/_libs/remark-gfm.mjs +0 -20
  155. package/dist/web-server/_libs/remark-parse.mjs +0 -19
  156. package/dist/web-server/_libs/remark-rehype.mjs +0 -21
  157. package/dist/web-server/_libs/reselect.mjs +0 -1
  158. package/dist/web-server/_libs/rou3.mjs +0 -8
  159. package/dist/web-server/_libs/seroval-plugins.mjs +0 -58
  160. package/dist/web-server/_libs/seroval.mjs +0 -1775
  161. package/dist/web-server/_libs/space-separated-tokens.mjs +0 -11
  162. package/dist/web-server/_libs/srvx.mjs +0 -781
  163. package/dist/web-server/_libs/style-to-js.mjs +0 -72
  164. package/dist/web-server/_libs/style-to-object.mjs +0 -38
  165. package/dist/web-server/_libs/tabler__icons-react.mjs +0 -230
  166. package/dist/web-server/_libs/tanstack__history.mjs +0 -204
  167. package/dist/web-server/_libs/tanstack__query-core.mjs +0 -2552
  168. package/dist/web-server/_libs/tanstack__react-query.mjs +0 -190
  169. package/dist/web-server/_libs/tanstack__react-router.mjs +0 -1120
  170. package/dist/web-server/_libs/tanstack__react-store.mjs +0 -2
  171. package/dist/web-server/_libs/tanstack__router-core.mjs +0 -4288
  172. package/dist/web-server/_libs/tanstack__store.mjs +0 -1
  173. package/dist/web-server/_libs/trim-lines.mjs +0 -41
  174. package/dist/web-server/_libs/trough.mjs +0 -85
  175. package/dist/web-server/_libs/ufo.mjs +0 -54
  176. package/dist/web-server/_libs/unctx.mjs +0 -1
  177. package/dist/web-server/_libs/ungap__structured-clone.mjs +0 -224
  178. package/dist/web-server/_libs/unified.mjs +0 -661
  179. package/dist/web-server/_libs/unist-util-is.mjs +0 -100
  180. package/dist/web-server/_libs/unist-util-position.mjs +0 -27
  181. package/dist/web-server/_libs/unist-util-stringify-position.mjs +0 -27
  182. package/dist/web-server/_libs/unist-util-visit-parents.mjs +0 -83
  183. package/dist/web-server/_libs/unist-util-visit.mjs +0 -24
  184. package/dist/web-server/_libs/unstorage.mjs +0 -1
  185. package/dist/web-server/_libs/use-sync-external-store.mjs +0 -139
  186. package/dist/web-server/_libs/vfile-message.mjs +0 -138
  187. package/dist/web-server/_libs/vfile.mjs +0 -467
  188. package/dist/web-server/_libs/zod.mjs +0 -3915
  189. package/dist/web-server/_libs/zustand.mjs +0 -343
  190. package/dist/web-server/_libs/zwitch.mjs +0 -1
  191. package/dist/web-server/_ssr/index-0n2Z3BPQ.mjs +0 -369
  192. package/dist/web-server/_ssr/index-6itDALOw.mjs +0 -339
  193. package/dist/web-server/_ssr/index-BIRTrOmp.mjs +0 -449
  194. package/dist/web-server/_ssr/index-BPzfADac.mjs +0 -66
  195. package/dist/web-server/_ssr/index-BQE3bF14.mjs +0 -1870
  196. package/dist/web-server/_ssr/index-C5HpvlUP.mjs +0 -190
  197. package/dist/web-server/_ssr/index-C_ZxnypN.mjs +0 -213
  198. package/dist/web-server/_ssr/index-Ca8JFH8f.mjs +0 -612
  199. package/dist/web-server/_ssr/index-DNVESZiA.mjs +0 -513
  200. package/dist/web-server/_ssr/index.mjs +0 -1558
  201. package/dist/web-server/_ssr/input-CqXjTRQg.mjs +0 -20
  202. package/dist/web-server/_ssr/queries-3H_19mUt.mjs +0 -16
  203. package/dist/web-server/_ssr/router-sbsNus0Y.mjs +0 -2093
  204. package/dist/web-server/_ssr/start-HYkvq4Ni.mjs +0 -4
  205. package/dist/web-server/_ssr/switch-usf2F1UM.mjs +0 -33
  206. package/dist/web-server/_ssr/syntax-highlighter-5vezNTce.mjs +0 -62
  207. package/dist/web-server/_ssr/textarea-DfRheWY0.mjs +0 -18
  208. package/dist/web-server/_tanstack-start-manifest_v-DqW-pKEH.mjs +0 -4
  209. package/dist/web-server/index.mjs +0 -597
@@ -1,156 +0,0 @@
1
- import { c as ccount } from "./ccount.mjs";
2
- import { o as ok } from "./devlop.mjs";
3
- import { u as unicodeWhitespace, d as unicodePunctuation } from "./micromark-util-character.mjs";
4
- import { f as findAndReplace } from "./mdast-util-find-and-replace.mjs";
5
- const inConstruct = "phrasing";
6
- const notInConstruct = ["autolink", "link", "image", "label"];
7
- function gfmAutolinkLiteralFromMarkdown() {
8
- return {
9
- transforms: [transformGfmAutolinkLiterals],
10
- enter: {
11
- literalAutolink: enterLiteralAutolink,
12
- literalAutolinkEmail: enterLiteralAutolinkValue,
13
- literalAutolinkHttp: enterLiteralAutolinkValue,
14
- literalAutolinkWww: enterLiteralAutolinkValue
15
- },
16
- exit: {
17
- literalAutolink: exitLiteralAutolink,
18
- literalAutolinkEmail: exitLiteralAutolinkEmail,
19
- literalAutolinkHttp: exitLiteralAutolinkHttp,
20
- literalAutolinkWww: exitLiteralAutolinkWww
21
- }
22
- };
23
- }
24
- function gfmAutolinkLiteralToMarkdown() {
25
- return {
26
- unsafe: [
27
- {
28
- character: "@",
29
- before: "[+\\-.\\w]",
30
- after: "[\\-.\\w]",
31
- inConstruct,
32
- notInConstruct
33
- },
34
- {
35
- character: ".",
36
- before: "[Ww]",
37
- after: "[\\-.\\w]",
38
- inConstruct,
39
- notInConstruct
40
- },
41
- {
42
- character: ":",
43
- before: "[ps]",
44
- after: "\\/",
45
- inConstruct,
46
- notInConstruct
47
- }
48
- ]
49
- };
50
- }
51
- function enterLiteralAutolink(token) {
52
- this.enter({ type: "link", title: null, url: "", children: [] }, token);
53
- }
54
- function enterLiteralAutolinkValue(token) {
55
- this.config.enter.autolinkProtocol.call(this, token);
56
- }
57
- function exitLiteralAutolinkHttp(token) {
58
- this.config.exit.autolinkProtocol.call(this, token);
59
- }
60
- function exitLiteralAutolinkWww(token) {
61
- this.config.exit.data.call(this, token);
62
- const node = this.stack[this.stack.length - 1];
63
- ok(node.type === "link");
64
- node.url = "http://" + this.sliceSerialize(token);
65
- }
66
- function exitLiteralAutolinkEmail(token) {
67
- this.config.exit.autolinkEmail.call(this, token);
68
- }
69
- function exitLiteralAutolink(token) {
70
- this.exit(token);
71
- }
72
- function transformGfmAutolinkLiterals(tree) {
73
- findAndReplace(
74
- tree,
75
- [
76
- [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl],
77
- [new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)", "gu"), findEmail]
78
- ],
79
- { ignore: ["link", "linkReference"] }
80
- );
81
- }
82
- function findUrl(_, protocol, domain, path, match) {
83
- let prefix = "";
84
- if (!previous(match)) {
85
- return false;
86
- }
87
- if (/^w/i.test(protocol)) {
88
- domain = protocol + domain;
89
- protocol = "";
90
- prefix = "http://";
91
- }
92
- if (!isCorrectDomain(domain)) {
93
- return false;
94
- }
95
- const parts = splitUrl(domain + path);
96
- if (!parts[0]) return false;
97
- const result = {
98
- type: "link",
99
- title: null,
100
- url: prefix + protocol + parts[0],
101
- children: [{ type: "text", value: protocol + parts[0] }]
102
- };
103
- if (parts[1]) {
104
- return [result, { type: "text", value: parts[1] }];
105
- }
106
- return result;
107
- }
108
- function findEmail(_, atext, label, match) {
109
- if (
110
- // Not an expected previous character.
111
- !previous(match, true) || // Label ends in not allowed character.
112
- /[-\d_]$/.test(label)
113
- ) {
114
- return false;
115
- }
116
- return {
117
- type: "link",
118
- title: null,
119
- url: "mailto:" + atext + "@" + label,
120
- children: [{ type: "text", value: atext + "@" + label }]
121
- };
122
- }
123
- function isCorrectDomain(domain) {
124
- const parts = domain.split(".");
125
- if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\d]/.test(parts[parts.length - 2]))) {
126
- return false;
127
- }
128
- return true;
129
- }
130
- function splitUrl(url) {
131
- const trailExec = /[!"&'),.:;<>?\]}]+$/.exec(url);
132
- if (!trailExec) {
133
- return [url, void 0];
134
- }
135
- url = url.slice(0, trailExec.index);
136
- let trail = trailExec[0];
137
- let closingParenIndex = trail.indexOf(")");
138
- const openingParens = ccount(url, "(");
139
- let closingParens = ccount(url, ")");
140
- while (closingParenIndex !== -1 && openingParens > closingParens) {
141
- url += trail.slice(0, closingParenIndex + 1);
142
- trail = trail.slice(closingParenIndex + 1);
143
- closingParenIndex = trail.indexOf(")");
144
- closingParens++;
145
- }
146
- return [url, trail];
147
- }
148
- function previous(match, email) {
149
- const code = match.input.charCodeAt(match.index - 1);
150
- return (match.index === 0 || unicodeWhitespace(code) || unicodePunctuation(code)) && // If it’s an email, the previous character should not be a slash.
151
- (!email || code !== 47);
152
- }
153
- export {
154
- gfmAutolinkLiteralToMarkdown as a,
155
- gfmAutolinkLiteralFromMarkdown as g
156
- };
@@ -1,117 +0,0 @@
1
- import { o as ok } from "./devlop.mjs";
2
- import { n as normalizeIdentifier } from "./micromark-util-normalize-identifier+[...].mjs";
3
- footnoteReference.peek = footnoteReferencePeek;
4
- function enterFootnoteCallString() {
5
- this.buffer();
6
- }
7
- function enterFootnoteCall(token) {
8
- this.enter({ type: "footnoteReference", identifier: "", label: "" }, token);
9
- }
10
- function enterFootnoteDefinitionLabelString() {
11
- this.buffer();
12
- }
13
- function enterFootnoteDefinition(token) {
14
- this.enter(
15
- { type: "footnoteDefinition", identifier: "", label: "", children: [] },
16
- token
17
- );
18
- }
19
- function exitFootnoteCallString(token) {
20
- const label = this.resume();
21
- const node = this.stack[this.stack.length - 1];
22
- ok(node.type === "footnoteReference");
23
- node.identifier = normalizeIdentifier(
24
- this.sliceSerialize(token)
25
- ).toLowerCase();
26
- node.label = label;
27
- }
28
- function exitFootnoteCall(token) {
29
- this.exit(token);
30
- }
31
- function exitFootnoteDefinitionLabelString(token) {
32
- const label = this.resume();
33
- const node = this.stack[this.stack.length - 1];
34
- ok(node.type === "footnoteDefinition");
35
- node.identifier = normalizeIdentifier(
36
- this.sliceSerialize(token)
37
- ).toLowerCase();
38
- node.label = label;
39
- }
40
- function exitFootnoteDefinition(token) {
41
- this.exit(token);
42
- }
43
- function footnoteReferencePeek() {
44
- return "[";
45
- }
46
- function footnoteReference(node, _, state, info) {
47
- const tracker = state.createTracker(info);
48
- let value = tracker.move("[^");
49
- const exit = state.enter("footnoteReference");
50
- const subexit = state.enter("reference");
51
- value += tracker.move(
52
- state.safe(state.associationId(node), { after: "]", before: value })
53
- );
54
- subexit();
55
- exit();
56
- value += tracker.move("]");
57
- return value;
58
- }
59
- function gfmFootnoteFromMarkdown() {
60
- return {
61
- enter: {
62
- gfmFootnoteCallString: enterFootnoteCallString,
63
- gfmFootnoteCall: enterFootnoteCall,
64
- gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,
65
- gfmFootnoteDefinition: enterFootnoteDefinition
66
- },
67
- exit: {
68
- gfmFootnoteCallString: exitFootnoteCallString,
69
- gfmFootnoteCall: exitFootnoteCall,
70
- gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,
71
- gfmFootnoteDefinition: exitFootnoteDefinition
72
- }
73
- };
74
- }
75
- function gfmFootnoteToMarkdown(options) {
76
- let firstLineBlank = false;
77
- if (options && options.firstLineBlank) {
78
- firstLineBlank = true;
79
- }
80
- return {
81
- handlers: { footnoteDefinition, footnoteReference },
82
- // This is on by default already.
83
- unsafe: [{ character: "[", inConstruct: ["label", "phrasing", "reference"] }]
84
- };
85
- function footnoteDefinition(node, _, state, info) {
86
- const tracker = state.createTracker(info);
87
- let value = tracker.move("[^");
88
- const exit = state.enter("footnoteDefinition");
89
- const subexit = state.enter("label");
90
- value += tracker.move(
91
- state.safe(state.associationId(node), { before: value, after: "]" })
92
- );
93
- subexit();
94
- value += tracker.move("]:");
95
- if (node.children && node.children.length > 0) {
96
- tracker.shift(4);
97
- value += tracker.move(
98
- (firstLineBlank ? "\n" : " ") + state.indentLines(
99
- state.containerFlow(node, tracker.current()),
100
- firstLineBlank ? mapAll : mapExceptFirst
101
- )
102
- );
103
- }
104
- exit();
105
- return value;
106
- }
107
- }
108
- function mapExceptFirst(line, index, blank) {
109
- return index === 0 ? line : mapAll(line, index, blank);
110
- }
111
- function mapAll(line, index, blank) {
112
- return (blank ? "" : " ") + line;
113
- }
114
- export {
115
- gfmFootnoteToMarkdown as a,
116
- gfmFootnoteFromMarkdown as g
117
- };
@@ -1,54 +0,0 @@
1
- const constructsWithoutStrikethrough = [
2
- "autolink",
3
- "destinationLiteral",
4
- "destinationRaw",
5
- "reference",
6
- "titleQuote",
7
- "titleApostrophe"
8
- ];
9
- handleDelete.peek = peekDelete;
10
- function gfmStrikethroughFromMarkdown() {
11
- return {
12
- canContainEols: ["delete"],
13
- enter: { strikethrough: enterStrikethrough },
14
- exit: { strikethrough: exitStrikethrough }
15
- };
16
- }
17
- function gfmStrikethroughToMarkdown() {
18
- return {
19
- unsafe: [
20
- {
21
- character: "~",
22
- inConstruct: "phrasing",
23
- notInConstruct: constructsWithoutStrikethrough
24
- }
25
- ],
26
- handlers: { delete: handleDelete }
27
- };
28
- }
29
- function enterStrikethrough(token) {
30
- this.enter({ type: "delete", children: [] }, token);
31
- }
32
- function exitStrikethrough(token) {
33
- this.exit(token);
34
- }
35
- function handleDelete(node, _, state, info) {
36
- const tracker = state.createTracker(info);
37
- const exit = state.enter("strikethrough");
38
- let value = tracker.move("~~");
39
- value += state.containerPhrasing(node, {
40
- ...tracker.current(),
41
- before: value,
42
- after: "~"
43
- });
44
- value += tracker.move("~~");
45
- exit();
46
- return value;
47
- }
48
- function peekDelete() {
49
- return "~";
50
- }
51
- export {
52
- gfmStrikethroughToMarkdown as a,
53
- gfmStrikethroughFromMarkdown as g
54
- };
@@ -1,157 +0,0 @@
1
- import { o as ok } from "./devlop.mjs";
2
- import { m as markdownTable } from "./markdown-table.mjs";
3
- import { h as handle } from "./mdast-util-to-markdown.mjs";
4
- function gfmTableFromMarkdown() {
5
- return {
6
- enter: {
7
- table: enterTable,
8
- tableData: enterCell,
9
- tableHeader: enterCell,
10
- tableRow: enterRow
11
- },
12
- exit: {
13
- codeText: exitCodeText,
14
- table: exitTable,
15
- tableData: exit,
16
- tableHeader: exit,
17
- tableRow: exit
18
- }
19
- };
20
- }
21
- function enterTable(token) {
22
- const align = token._align;
23
- this.enter(
24
- {
25
- type: "table",
26
- align: align.map(function(d) {
27
- return d === "none" ? null : d;
28
- }),
29
- children: []
30
- },
31
- token
32
- );
33
- this.data.inTable = true;
34
- }
35
- function exitTable(token) {
36
- this.exit(token);
37
- this.data.inTable = void 0;
38
- }
39
- function enterRow(token) {
40
- this.enter({ type: "tableRow", children: [] }, token);
41
- }
42
- function exit(token) {
43
- this.exit(token);
44
- }
45
- function enterCell(token) {
46
- this.enter({ type: "tableCell", children: [] }, token);
47
- }
48
- function exitCodeText(token) {
49
- let value = this.resume();
50
- if (this.data.inTable) {
51
- value = value.replace(/\\([\\|])/g, replace);
52
- }
53
- const node = this.stack[this.stack.length - 1];
54
- ok(node.type === "inlineCode");
55
- node.value = value;
56
- this.exit(token);
57
- }
58
- function replace($0, $1) {
59
- return $1 === "|" ? $1 : $0;
60
- }
61
- function gfmTableToMarkdown(options) {
62
- const settings = options || {};
63
- const padding = settings.tableCellPadding;
64
- const alignDelimiters = settings.tablePipeAlign;
65
- const stringLength = settings.stringLength;
66
- const around = padding ? " " : "|";
67
- return {
68
- unsafe: [
69
- { character: "\r", inConstruct: "tableCell" },
70
- { character: "\n", inConstruct: "tableCell" },
71
- // A pipe, when followed by a tab or space (padding), or a dash or colon
72
- // (unpadded delimiter row), could result in a table.
73
- { atBreak: true, character: "|", after: "[ :-]" },
74
- // A pipe in a cell must be encoded.
75
- { character: "|", inConstruct: "tableCell" },
76
- // A colon must be followed by a dash, in which case it could start a
77
- // delimiter row.
78
- { atBreak: true, character: ":", after: "-" },
79
- // A delimiter row can also start with a dash, when followed by more
80
- // dashes, a colon, or a pipe.
81
- // This is a stricter version than the built in check for lists, thematic
82
- // breaks, and setex heading underlines though:
83
- // <https://github.com/syntax-tree/mdast-util-to-markdown/blob/51a2038/lib/unsafe.js#L57>
84
- { atBreak: true, character: "-", after: "[:|-]" }
85
- ],
86
- handlers: {
87
- inlineCode: inlineCodeWithTable,
88
- table: handleTable,
89
- tableCell: handleTableCell,
90
- tableRow: handleTableRow
91
- }
92
- };
93
- function handleTable(node, _, state, info) {
94
- return serializeData(handleTableAsData(node, state, info), node.align);
95
- }
96
- function handleTableRow(node, _, state, info) {
97
- const row = handleTableRowAsData(node, state, info);
98
- const value = serializeData([row]);
99
- return value.slice(0, value.indexOf("\n"));
100
- }
101
- function handleTableCell(node, _, state, info) {
102
- const exit2 = state.enter("tableCell");
103
- const subexit = state.enter("phrasing");
104
- const value = state.containerPhrasing(node, {
105
- ...info,
106
- before: around,
107
- after: around
108
- });
109
- subexit();
110
- exit2();
111
- return value;
112
- }
113
- function serializeData(matrix, align) {
114
- return markdownTable(matrix, {
115
- align,
116
- // @ts-expect-error: `markdown-table` types should support `null`.
117
- alignDelimiters,
118
- // @ts-expect-error: `markdown-table` types should support `null`.
119
- padding,
120
- // @ts-expect-error: `markdown-table` types should support `null`.
121
- stringLength
122
- });
123
- }
124
- function handleTableAsData(node, state, info) {
125
- const children = node.children;
126
- let index = -1;
127
- const result = [];
128
- const subexit = state.enter("table");
129
- while (++index < children.length) {
130
- result[index] = handleTableRowAsData(children[index], state, info);
131
- }
132
- subexit();
133
- return result;
134
- }
135
- function handleTableRowAsData(node, state, info) {
136
- const children = node.children;
137
- let index = -1;
138
- const result = [];
139
- const subexit = state.enter("tableRow");
140
- while (++index < children.length) {
141
- result[index] = handleTableCell(children[index], node, state, info);
142
- }
143
- subexit();
144
- return result;
145
- }
146
- function inlineCodeWithTable(node, parent, state) {
147
- let value = handle.inlineCode(node, parent, state);
148
- if (state.stack.includes("tableCell")) {
149
- value = value.replace(/\|/g, "\\$&");
150
- }
151
- return value;
152
- }
153
- }
154
- export {
155
- gfmTableToMarkdown as a,
156
- gfmTableFromMarkdown as g
157
- };
@@ -1,77 +0,0 @@
1
- import { o as ok } from "./devlop.mjs";
2
- import { h as handle } from "./mdast-util-to-markdown.mjs";
3
- function gfmTaskListItemFromMarkdown() {
4
- return {
5
- exit: {
6
- taskListCheckValueChecked: exitCheck,
7
- taskListCheckValueUnchecked: exitCheck,
8
- paragraph: exitParagraphWithTaskListItem
9
- }
10
- };
11
- }
12
- function gfmTaskListItemToMarkdown() {
13
- return {
14
- unsafe: [{ atBreak: true, character: "-", after: "[:|-]" }],
15
- handlers: { listItem: listItemWithTaskListItem }
16
- };
17
- }
18
- function exitCheck(token) {
19
- const node = this.stack[this.stack.length - 2];
20
- ok(node.type === "listItem");
21
- node.checked = token.type === "taskListCheckValueChecked";
22
- }
23
- function exitParagraphWithTaskListItem(token) {
24
- const parent = this.stack[this.stack.length - 2];
25
- if (parent && parent.type === "listItem" && typeof parent.checked === "boolean") {
26
- const node = this.stack[this.stack.length - 1];
27
- ok(node.type === "paragraph");
28
- const head = node.children[0];
29
- if (head && head.type === "text") {
30
- const siblings = parent.children;
31
- let index = -1;
32
- let firstParaghraph;
33
- while (++index < siblings.length) {
34
- const sibling = siblings[index];
35
- if (sibling.type === "paragraph") {
36
- firstParaghraph = sibling;
37
- break;
38
- }
39
- }
40
- if (firstParaghraph === node) {
41
- head.value = head.value.slice(1);
42
- if (head.value.length === 0) {
43
- node.children.shift();
44
- } else if (node.position && head.position && typeof head.position.start.offset === "number") {
45
- head.position.start.column++;
46
- head.position.start.offset++;
47
- node.position.start = Object.assign({}, head.position.start);
48
- }
49
- }
50
- }
51
- }
52
- this.exit(token);
53
- }
54
- function listItemWithTaskListItem(node, parent, state, info) {
55
- const head = node.children[0];
56
- const checkable = typeof node.checked === "boolean" && head && head.type === "paragraph";
57
- const checkbox = "[" + (node.checked ? "x" : " ") + "] ";
58
- const tracker = state.createTracker(info);
59
- if (checkable) {
60
- tracker.move(checkbox);
61
- }
62
- let value = handle.listItem(node, parent, state, {
63
- ...info,
64
- ...tracker.current()
65
- });
66
- if (checkable) {
67
- value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check);
68
- }
69
- return value;
70
- function check($0) {
71
- return $0 + checkbox;
72
- }
73
- }
74
- export {
75
- gfmTaskListItemToMarkdown as a,
76
- gfmTaskListItemFromMarkdown as g
77
- };
@@ -1,29 +0,0 @@
1
- import { g as gfmAutolinkLiteralFromMarkdown, a as gfmAutolinkLiteralToMarkdown } from "./mdast-util-gfm-autolink-literal+[...].mjs";
2
- import { g as gfmFootnoteFromMarkdown, a as gfmFootnoteToMarkdown } from "./mdast-util-gfm-footnote.mjs";
3
- import { g as gfmStrikethroughFromMarkdown, a as gfmStrikethroughToMarkdown } from "./mdast-util-gfm-strikethrough.mjs";
4
- import { g as gfmTableFromMarkdown, a as gfmTableToMarkdown } from "./mdast-util-gfm-table.mjs";
5
- import { g as gfmTaskListItemFromMarkdown, a as gfmTaskListItemToMarkdown } from "./mdast-util-gfm-task-list-item.mjs";
6
- function gfmFromMarkdown() {
7
- return [
8
- gfmAutolinkLiteralFromMarkdown(),
9
- gfmFootnoteFromMarkdown(),
10
- gfmStrikethroughFromMarkdown(),
11
- gfmTableFromMarkdown(),
12
- gfmTaskListItemFromMarkdown()
13
- ];
14
- }
15
- function gfmToMarkdown(options) {
16
- return {
17
- extensions: [
18
- gfmAutolinkLiteralToMarkdown(),
19
- gfmFootnoteToMarkdown(options),
20
- gfmStrikethroughToMarkdown(),
21
- gfmTableToMarkdown(options),
22
- gfmTaskListItemToMarkdown()
23
- ]
24
- };
25
- }
26
- export {
27
- gfmToMarkdown as a,
28
- gfmFromMarkdown as g
29
- };
@@ -1,30 +0,0 @@
1
- import { c as convert } from "./unist-util-is.mjs";
2
- const phrasing = (
3
- /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
4
- convert([
5
- "break",
6
- "delete",
7
- "emphasis",
8
- // To do: next major: removed since footnotes were added to GFM.
9
- "footnote",
10
- "footnoteReference",
11
- "image",
12
- "imageReference",
13
- "inlineCode",
14
- // Enabled by `mdast-util-math`:
15
- "inlineMath",
16
- "link",
17
- "linkReference",
18
- // Enabled by `mdast-util-mdx`:
19
- "mdxJsxTextElement",
20
- // Enabled by `mdast-util-mdx`:
21
- "mdxTextExpression",
22
- "strong",
23
- "text",
24
- // Enabled by `mdast-util-directive`:
25
- "textDirective"
26
- ])
27
- );
28
- export {
29
- phrasing as p
30
- };