@kerebron/extension-codejar 0.4.5 → 0.4.6

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 (248) hide show
  1. package/esm/{extension-codejar/src/CodeJar.d.ts → CodeJar.d.ts} +1 -1
  2. package/esm/CodeJar.d.ts.map +1 -0
  3. package/esm/{extension-codejar/src/CodeJar.js → CodeJar.js} +1 -1
  4. package/esm/Decorator.d.ts.map +1 -0
  5. package/esm/{extension-codejar/src/ExtensionCodeJar.d.ts → ExtensionCodeJar.d.ts} +1 -1
  6. package/esm/ExtensionCodeJar.d.ts.map +1 -0
  7. package/esm/{extension-codejar/src/ExtensionCodeJar.js → ExtensionCodeJar.js} +2 -2
  8. package/esm/{extension-codejar/src/NodeCodeJar.d.ts → NodeCodeJar.d.ts} +3 -3
  9. package/esm/NodeCodeJar.d.ts.map +1 -0
  10. package/esm/{extension-codejar/src/NodeCodeJar.js → NodeCodeJar.js} +3 -3
  11. package/esm/{extension-codejar/src/TreeSitterHighlighter.d.ts → TreeSitterHighlighter.d.ts} +1 -1
  12. package/esm/TreeSitterHighlighter.d.ts.map +1 -0
  13. package/esm/{extension-codejar/src/TreeSitterHighlighter.js → TreeSitterHighlighter.js} +3 -8
  14. package/esm/{extension-codejar/src/codeJarBlockNodeView.d.ts → codeJarBlockNodeView.d.ts} +1 -1
  15. package/esm/codeJarBlockNodeView.d.ts.map +1 -0
  16. package/esm/{extension-codejar/src/codeJarBlockNodeView.js → codeJarBlockNodeView.js} +2 -2
  17. package/esm/codeJarLineNumbers.d.ts.map +1 -0
  18. package/esm/mod.d.ts +2 -0
  19. package/esm/mod.d.ts.map +1 -0
  20. package/esm/{extension-codejar/src/mod.js → mod.js} +0 -1
  21. package/esm/utils.d.ts.map +1 -0
  22. package/package.json +10 -6
  23. package/esm/_dnt.polyfills.d.ts +0 -101
  24. package/esm/_dnt.polyfills.d.ts.map +0 -1
  25. package/esm/_dnt.polyfills.js +0 -127
  26. package/esm/editor/src/CoreEditor.d.ts +0 -40
  27. package/esm/editor/src/CoreEditor.d.ts.map +0 -1
  28. package/esm/editor/src/CoreEditor.js +0 -252
  29. package/esm/editor/src/DummyEditorView.d.ts +0 -60
  30. package/esm/editor/src/DummyEditorView.d.ts.map +0 -1
  31. package/esm/editor/src/DummyEditorView.js +0 -277
  32. package/esm/editor/src/Extension.d.ts +0 -31
  33. package/esm/editor/src/Extension.d.ts.map +0 -1
  34. package/esm/editor/src/Extension.js +0 -53
  35. package/esm/editor/src/ExtensionManager.d.ts +0 -32
  36. package/esm/editor/src/ExtensionManager.d.ts.map +0 -1
  37. package/esm/editor/src/ExtensionManager.js +0 -260
  38. package/esm/editor/src/Mark.d.ts +0 -23
  39. package/esm/editor/src/Mark.d.ts.map +0 -1
  40. package/esm/editor/src/Mark.js +0 -51
  41. package/esm/editor/src/Node.d.ts +0 -32
  42. package/esm/editor/src/Node.d.ts.map +0 -1
  43. package/esm/editor/src/Node.js +0 -60
  44. package/esm/editor/src/commands/CommandManager.d.ts +0 -23
  45. package/esm/editor/src/commands/CommandManager.d.ts.map +0 -1
  46. package/esm/editor/src/commands/CommandManager.js +0 -118
  47. package/esm/editor/src/commands/baseCommandFactories.d.ts +0 -3
  48. package/esm/editor/src/commands/baseCommandFactories.d.ts.map +0 -1
  49. package/esm/editor/src/commands/baseCommandFactories.js +0 -836
  50. package/esm/editor/src/commands/createChainableState.d.ts +0 -3
  51. package/esm/editor/src/commands/createChainableState.d.ts.map +0 -1
  52. package/esm/editor/src/commands/createChainableState.js +0 -29
  53. package/esm/editor/src/commands/keyCommandFactories.d.ts +0 -3
  54. package/esm/editor/src/commands/keyCommandFactories.d.ts.map +0 -1
  55. package/esm/editor/src/commands/keyCommandFactories.js +0 -10
  56. package/esm/editor/src/commands/mod.d.ts +0 -7
  57. package/esm/editor/src/commands/mod.d.ts.map +0 -1
  58. package/esm/editor/src/commands/mod.js +0 -76
  59. package/esm/editor/src/commands/replaceCommandFactories.d.ts +0 -3
  60. package/esm/editor/src/commands/replaceCommandFactories.d.ts.map +0 -1
  61. package/esm/editor/src/commands/replaceCommandFactories.js +0 -94
  62. package/esm/editor/src/commands/types.d.ts +0 -18
  63. package/esm/editor/src/commands/types.d.ts.map +0 -1
  64. package/esm/editor/src/commands/types.js +0 -1
  65. package/esm/editor/src/mod.d.ts +0 -9
  66. package/esm/editor/src/mod.d.ts.map +0 -1
  67. package/esm/editor/src/mod.js +0 -8
  68. package/esm/editor/src/nodeToTreeString.d.ts +0 -10
  69. package/esm/editor/src/nodeToTreeString.d.ts.map +0 -1
  70. package/esm/editor/src/nodeToTreeString.js +0 -74
  71. package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts +0 -6
  72. package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts.map +0 -1
  73. package/esm/editor/src/plugins/TrackSelecionPlugin.js +0 -24
  74. package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts +0 -23
  75. package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts.map +0 -1
  76. package/esm/editor/src/plugins/input-rules/InputRulesPlugin.js +0 -163
  77. package/esm/editor/src/plugins/input-rules/mod.d.ts +0 -3
  78. package/esm/editor/src/plugins/input-rules/mod.d.ts.map +0 -1
  79. package/esm/editor/src/plugins/input-rules/mod.js +0 -2
  80. package/esm/editor/src/plugins/input-rules/rulebuilders.d.ts +0 -5
  81. package/esm/editor/src/plugins/input-rules/rulebuilders.d.ts.map +0 -1
  82. package/esm/editor/src/plugins/input-rules/rulebuilders.js +0 -50
  83. package/esm/editor/src/plugins/keymap/keymap.d.ts +0 -11
  84. package/esm/editor/src/plugins/keymap/keymap.d.ts.map +0 -1
  85. package/esm/editor/src/plugins/keymap/keymap.js +0 -125
  86. package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts +0 -4
  87. package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts.map +0 -1
  88. package/esm/editor/src/plugins/keymap/w3c-keyname.js +0 -124
  89. package/esm/editor/src/types.d.ts +0 -52
  90. package/esm/editor/src/types.d.ts.map +0 -1
  91. package/esm/editor/src/types.js +0 -1
  92. package/esm/editor/src/ui.d.ts +0 -15
  93. package/esm/editor/src/ui.d.ts.map +0 -1
  94. package/esm/editor/src/ui.js +0 -16
  95. package/esm/editor/src/utilities/SmartOutput.d.ts +0 -41
  96. package/esm/editor/src/utilities/SmartOutput.d.ts.map +0 -1
  97. package/esm/editor/src/utilities/SmartOutput.js +0 -228
  98. package/esm/editor/src/utilities/createNodeFromContent.d.ts +0 -9
  99. package/esm/editor/src/utilities/createNodeFromContent.d.ts.map +0 -1
  100. package/esm/editor/src/utilities/createNodeFromContent.js +0 -32
  101. package/esm/editor/src/utilities/getHtmlAttributes.d.ts +0 -9
  102. package/esm/editor/src/utilities/getHtmlAttributes.d.ts.map +0 -1
  103. package/esm/editor/src/utilities/getHtmlAttributes.js +0 -47
  104. package/esm/editor/src/utilities/getShadowRoot.d.ts +0 -2
  105. package/esm/editor/src/utilities/getShadowRoot.d.ts.map +0 -1
  106. package/esm/editor/src/utilities/getShadowRoot.js +0 -16
  107. package/esm/editor/src/utilities/mod.d.ts +0 -6
  108. package/esm/editor/src/utilities/mod.d.ts.map +0 -1
  109. package/esm/editor/src/utilities/mod.js +0 -5
  110. package/esm/editor/src/utilities/toRawTextResult.d.ts +0 -3
  111. package/esm/editor/src/utilities/toRawTextResult.d.ts.map +0 -1
  112. package/esm/editor/src/utilities/toRawTextResult.js +0 -21
  113. package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts +0 -8
  114. package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts.map +0 -1
  115. package/esm/extension-autocomplete/src/AutocompletePlugin.js +0 -232
  116. package/esm/extension-autocomplete/src/DefaultRenderer.d.ts +0 -17
  117. package/esm/extension-autocomplete/src/DefaultRenderer.d.ts.map +0 -1
  118. package/esm/extension-autocomplete/src/DefaultRenderer.js +0 -137
  119. package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts +0 -26
  120. package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts.map +0 -1
  121. package/esm/extension-autocomplete/src/ExtensionAutocomplete.js +0 -30
  122. package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts +0 -11
  123. package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts.map +0 -1
  124. package/esm/extension-autocomplete/src/createDefaultMatcher.js +0 -58
  125. package/esm/extension-autocomplete/src/createRegexMatcher.d.ts +0 -4
  126. package/esm/extension-autocomplete/src/createRegexMatcher.d.ts.map +0 -1
  127. package/esm/extension-autocomplete/src/createRegexMatcher.js +0 -50
  128. package/esm/extension-autocomplete/src/mod.d.ts +0 -3
  129. package/esm/extension-autocomplete/src/mod.d.ts.map +0 -1
  130. package/esm/extension-autocomplete/src/mod.js +0 -2
  131. package/esm/extension-autocomplete/src/types.d.ts +0 -60
  132. package/esm/extension-autocomplete/src/types.d.ts.map +0 -1
  133. package/esm/extension-autocomplete/src/types.js +0 -1
  134. package/esm/extension-basic-editor/src/ExtensionHtml.d.ts +0 -15
  135. package/esm/extension-basic-editor/src/ExtensionHtml.d.ts.map +0 -1
  136. package/esm/extension-basic-editor/src/ExtensionHtml.js +0 -108
  137. package/esm/extension-basic-editor/src/NodeCodeBlock.d.ts +0 -9
  138. package/esm/extension-basic-editor/src/NodeCodeBlock.d.ts.map +0 -1
  139. package/esm/extension-basic-editor/src/NodeCodeBlock.js +0 -58
  140. package/esm/extension-codejar/src/CodeJar.d.ts.map +0 -1
  141. package/esm/extension-codejar/src/Decorator.d.ts.map +0 -1
  142. package/esm/extension-codejar/src/ExtensionCodeJar.d.ts.map +0 -1
  143. package/esm/extension-codejar/src/NodeCodeJar.d.ts.map +0 -1
  144. package/esm/extension-codejar/src/TreeSitterHighlighter.d.ts.map +0 -1
  145. package/esm/extension-codejar/src/codeJarBlockNodeView.d.ts.map +0 -1
  146. package/esm/extension-codejar/src/codeJarLineNumbers.d.ts.map +0 -1
  147. package/esm/extension-codejar/src/mod.d.ts +0 -3
  148. package/esm/extension-codejar/src/mod.d.ts.map +0 -1
  149. package/esm/extension-codejar/src/utils.d.ts.map +0 -1
  150. package/esm/extension-lsp/src/DiagnosticPlugin.d.ts +0 -32
  151. package/esm/extension-lsp/src/DiagnosticPlugin.d.ts.map +0 -1
  152. package/esm/extension-lsp/src/DiagnosticPlugin.js +0 -131
  153. package/esm/extension-lsp/src/ExtensionLsp.d.ts +0 -25
  154. package/esm/extension-lsp/src/ExtensionLsp.d.ts.map +0 -1
  155. package/esm/extension-lsp/src/ExtensionLsp.js +0 -126
  156. package/esm/extension-lsp/src/LSPClient.d.ts +0 -56
  157. package/esm/extension-lsp/src/LSPClient.d.ts.map +0 -1
  158. package/esm/extension-lsp/src/LSPClient.js +0 -449
  159. package/esm/extension-lsp/src/computeIncrementalChanges.d.ts +0 -8
  160. package/esm/extension-lsp/src/computeIncrementalChanges.d.ts.map +0 -1
  161. package/esm/extension-lsp/src/computeIncrementalChanges.js +0 -82
  162. package/esm/extension-lsp/src/createLspAutocomplete.d.ts +0 -23
  163. package/esm/extension-lsp/src/createLspAutocomplete.d.ts.map +0 -1
  164. package/esm/extension-lsp/src/createLspAutocomplete.js +0 -68
  165. package/esm/extension-lsp/src/mod.d.ts +0 -4
  166. package/esm/extension-lsp/src/mod.d.ts.map +0 -1
  167. package/esm/extension-lsp/src/mod.js +0 -3
  168. package/esm/extension-lsp/src/workspace.d.ts +0 -62
  169. package/esm/extension-lsp/src/workspace.d.ts.map +0 -1
  170. package/esm/extension-lsp/src/workspace.js +0 -168
  171. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts +0 -36
  172. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts.map +0 -1
  173. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.js +0 -240
  174. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts +0 -26
  175. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts.map +0 -1
  176. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.js +0 -115
  177. package/esm/extension-markdown/src/ExtensionMarkdown.d.ts +0 -22
  178. package/esm/extension-markdown/src/ExtensionMarkdown.d.ts.map +0 -1
  179. package/esm/extension-markdown/src/ExtensionMarkdown.js +0 -48
  180. package/esm/extension-markdown/src/MarkdownParser.d.ts +0 -61
  181. package/esm/extension-markdown/src/MarkdownParser.d.ts.map +0 -1
  182. package/esm/extension-markdown/src/MarkdownParser.js +0 -249
  183. package/esm/extension-markdown/src/MarkdownSerializer.d.ts +0 -42
  184. package/esm/extension-markdown/src/MarkdownSerializer.d.ts.map +0 -1
  185. package/esm/extension-markdown/src/MarkdownSerializer.js +0 -325
  186. package/esm/extension-markdown/src/PositionMapper.d.ts +0 -15
  187. package/esm/extension-markdown/src/PositionMapper.d.ts.map +0 -1
  188. package/esm/extension-markdown/src/PositionMapper.js +0 -100
  189. package/esm/extension-markdown/src/TokenSource.d.ts +0 -11
  190. package/esm/extension-markdown/src/TokenSource.d.ts.map +0 -1
  191. package/esm/extension-markdown/src/TokenSource.js +0 -39
  192. package/esm/extension-markdown/src/mdToPmConverter.d.ts +0 -5
  193. package/esm/extension-markdown/src/mdToPmConverter.d.ts.map +0 -1
  194. package/esm/extension-markdown/src/mdToPmConverter.js +0 -111
  195. package/esm/extension-markdown/src/pmToMdConverter.d.ts +0 -16
  196. package/esm/extension-markdown/src/pmToMdConverter.d.ts.map +0 -1
  197. package/esm/extension-markdown/src/pmToMdConverter.js +0 -433
  198. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts +0 -4
  199. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts.map +0 -1
  200. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.js +0 -151
  201. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts +0 -3
  202. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts.map +0 -1
  203. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.js +0 -34
  204. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts +0 -6
  205. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts.map +0 -1
  206. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.js +0 -380
  207. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts +0 -3
  208. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts.map +0 -1
  209. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.js +0 -323
  210. package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts +0 -9
  211. package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts.map +0 -1
  212. package/esm/extension-markdown/src/token_handlers/table_token_handlers.js +0 -308
  213. package/esm/extension-markdown/src/treeSitterTokenizer.d.ts +0 -5
  214. package/esm/extension-markdown/src/treeSitterTokenizer.d.ts.map +0 -1
  215. package/esm/extension-markdown/src/treeSitterTokenizer.js +0 -769
  216. package/esm/extension-markdown/src/types.d.ts +0 -28
  217. package/esm/extension-markdown/src/types.d.ts.map +0 -1
  218. package/esm/extension-markdown/src/types.js +0 -131
  219. package/esm/extension-markdown/src/utils.d.ts +0 -8
  220. package/esm/extension-markdown/src/utils.d.ts.map +0 -1
  221. package/esm/extension-markdown/src/utils.js +0 -86
  222. package/esm/tree-sitter-shim/src/main.d.ts +0 -15
  223. package/esm/tree-sitter-shim/src/main.d.ts.map +0 -1
  224. package/esm/tree-sitter-shim/src/main.js +0 -25
  225. package/esm/tree-sitter-shim/src/tree_sitter/language.d.ts +0 -7
  226. package/esm/tree-sitter-shim/src/tree_sitter/language.d.ts.map +0 -1
  227. package/esm/tree-sitter-shim/src/tree_sitter/language.js +0 -5
  228. package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts +0 -6
  229. package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts.map +0 -1
  230. package/esm/tree-sitter-shim/src/tree_sitter/node.js +0 -1
  231. package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts +0 -7
  232. package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts.map +0 -1
  233. package/esm/tree-sitter-shim/src/tree_sitter/parser.js +0 -5
  234. package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts +0 -6
  235. package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts.map +0 -1
  236. package/esm/tree-sitter-shim/src/tree_sitter/tree.js +0 -1
  237. package/esm/wasm/src/mod.d.ts +0 -12
  238. package/esm/wasm/src/mod.d.ts.map +0 -1
  239. package/esm/wasm/src/mod.js +0 -48
  240. package/esm/wasm/wasm.d.ts +0 -138
  241. package/esm/wasm/wasm.d.ts.map +0 -1
  242. package/esm/wasm/wasm.js +0 -120
  243. /package/esm/{extension-codejar/src/Decorator.d.ts → Decorator.d.ts} +0 -0
  244. /package/esm/{extension-codejar/src/Decorator.js → Decorator.js} +0 -0
  245. /package/esm/{extension-codejar/src/codeJarLineNumbers.d.ts → codeJarLineNumbers.d.ts} +0 -0
  246. /package/esm/{extension-codejar/src/codeJarLineNumbers.js → codeJarLineNumbers.js} +0 -0
  247. /package/esm/{extension-codejar/src/utils.d.ts → utils.d.ts} +0 -0
  248. /package/esm/{extension-codejar/src/utils.js → utils.js} +0 -0
@@ -1,323 +0,0 @@
1
- import { writeIndented, } from '../MarkdownSerializer.js';
2
- import { getHtmlInlineTokensHandlers, getInlineTokensHandlers, } from './inline_token_handlers.js';
3
- import { numberString } from '../utils.js';
4
- function getLongDefinitionTokensHandlers() {
5
- return {
6
- ...getInlineTokensHandlers(),
7
- 'hardbreak': [
8
- (token, ctx) => {
9
- ctx.current.log('\n');
10
- if (ctx.current.meta['para_hidden']) {
11
- ctx.current.itemSymbol = '';
12
- }
13
- ctx.current.itemRow++;
14
- },
15
- ],
16
- 'code_block': [
17
- (token, ctx) => {
18
- if (ctx.current.itemRow === 0) {
19
- ctx.current.itemRow++;
20
- }
21
- if (ctx.output.colPos > 0) {
22
- ctx.current.log('\n');
23
- }
24
- if (!ctx.output.endsWith('\n\n')) {
25
- ctx.current.log('\n');
26
- }
27
- ctx.stash('getLongDefinitionTokensHandlers.code_block');
28
- ctx.current.log = (txt) => {
29
- writeIndented(ctx.output, txt, ctx.current, token);
30
- };
31
- ctx.current.log(token.content
32
- .split('\n')
33
- .map((t) => t.trim() ? (' ' + t) : '')
34
- .join('\n') + '\n');
35
- ctx.unstash('getLongDefinitionTokensHandlers.code_block');
36
- ctx.current.itemRow++;
37
- },
38
- ],
39
- 'paragraph_open': [
40
- (token, ctx) => {
41
- ctx.stash('getLongDefinitionTokensHandlers.paragraph_open');
42
- ctx.current.meta['para_hidden'] = token.hidden;
43
- },
44
- ],
45
- 'paragraph_close': [
46
- (token, ctx) => {
47
- ctx.unstash('getLongDefinitionTokensHandlers.paragraph_close');
48
- if (ctx.output.colPos !== 0) {
49
- // ctx.current.log('\n');
50
- }
51
- ctx.current.itemRow++;
52
- },
53
- ],
54
- 'dt_open': [
55
- (token, ctx) => {
56
- ctx.current.itemSymbol = '';
57
- ctx.current.itemRow = 0;
58
- },
59
- ],
60
- 'dt_close': [
61
- (token, ctx) => {
62
- if (ctx.output.colPos !== 0) {
63
- ctx.current.log('\n');
64
- }
65
- },
66
- ],
67
- 'dd_open': [
68
- (token, ctx) => {
69
- if (!ctx.output.endsWith('\n\n')) {
70
- ctx.current.log('\n');
71
- }
72
- ctx.current.itemSymbol = ': ';
73
- ctx.current.itemRow = 0;
74
- },
75
- ],
76
- 'dd_close': [
77
- (token, ctx) => {
78
- if (ctx.output.colPos !== 0) {
79
- ctx.current.log('\n');
80
- }
81
- },
82
- ],
83
- 'dl_open': [
84
- (token, ctx) => {
85
- ctx.stash('getLongDefinitionTokensHandlers.dl_open');
86
- ctx.current.listPath.push('dl');
87
- ctx.current.listType = 'dl';
88
- },
89
- ],
90
- 'dl_close': [
91
- (token, ctx) => {
92
- ctx.unstash('getLongDefinitionTokensHandlers.dl_close');
93
- },
94
- ],
95
- };
96
- }
97
- function getShortDefinitionTokensHandlers() {
98
- const rollbackList = (token, ctx, tokenSource) => {
99
- const rollbackPos = ctx.current.meta['def_rollback'];
100
- if (!ctx.current.meta['def_token_start']) {
101
- throw new Error('No def_token_start');
102
- }
103
- const outputPos = ctx.current.meta['def_output_pos'];
104
- if (!ctx.current.meta['def_output_pos']) {
105
- throw new Error('No def_output_pos');
106
- }
107
- tokenSource.rewind(ctx.current.meta['def_token_start']);
108
- ctx.rollback(rollbackPos, 'rollbackList, ' + token.type);
109
- ctx.output.rollback(outputPos);
110
- ctx.stash('getShortDefinitionTokensHandlers.rollbackList');
111
- ctx.current.listPath.push('dl');
112
- ctx.current.listType = 'dl';
113
- ctx.current.handlers = getLongDefinitionTokensHandlers();
114
- };
115
- return {
116
- 'dl_open': [
117
- (token, ctx, tokenSource) => {
118
- const rollbackPos = ctx.stash('getShortDefinitionTokensHandlers.dl_open');
119
- ctx.current.meta['def_rollback'] = rollbackPos;
120
- ctx.current.meta['def_token_start'] = tokenSource.pos;
121
- ctx.current.meta['def_output_pos'] = ctx.output.chunkPos;
122
- ctx.current.listPath.push('dl');
123
- ctx.current.listType = 'dl';
124
- ctx.current.handlers = getShortDefinitionTokensHandlers();
125
- },
126
- ],
127
- 'dl_close': [
128
- (token, ctx) => {
129
- ctx.unstash('getShortDefinitionTokensHandlers.dl_close');
130
- },
131
- ],
132
- ...getInlineTokensHandlers(),
133
- 'hardbreak': [
134
- rollbackList,
135
- ],
136
- 'code_block': [
137
- rollbackList,
138
- ],
139
- 'paragraph_open': [
140
- (token, ctx) => {
141
- // Skip, as paragraphs are implied by newlines
142
- },
143
- ],
144
- 'paragraph_close': [
145
- (token, ctx) => {
146
- if (ctx.output.colPos !== 0) {
147
- // ctx.current.log('\n');
148
- }
149
- },
150
- ],
151
- 'dt_open': [
152
- (token, ctx) => {
153
- ctx.current.itemSymbol = '';
154
- ctx.current.itemRow = 0;
155
- },
156
- ],
157
- 'dt_close': [
158
- (token, ctx) => {
159
- if (ctx.output.colPos !== 0) {
160
- ctx.current.log('\n');
161
- }
162
- },
163
- ],
164
- 'dd_open': [
165
- (token, ctx) => {
166
- ctx.current.itemSymbol = ' ~ ';
167
- ctx.current.itemRow = 0;
168
- },
169
- ],
170
- 'dd_close': [
171
- (token, ctx) => {
172
- if (ctx.output.colPos !== 0) {
173
- ctx.current.log('\n');
174
- }
175
- },
176
- ],
177
- };
178
- }
179
- export function getListsTokensHandlers() {
180
- return {
181
- 'dl_open': getShortDefinitionTokensHandlers()['dl_open'],
182
- 'paragraph_close': [
183
- (token, ctx) => {
184
- if (ctx.output.colPos !== 0) {
185
- ctx.current.log('\n', token);
186
- }
187
- ctx.current.itemRow++;
188
- },
189
- ],
190
- 'task_list_open': [
191
- (token, ctx) => {
192
- ctx.stash('getListsTokensHandlers.task_list_open');
193
- ctx.current.listPath.push('tl');
194
- ctx.current.listType = 'tl';
195
- ctx.current.itemSymbol = '';
196
- ctx.current.itemNumber = 0;
197
- },
198
- ],
199
- 'task_list_close': [
200
- (token, ctx) => {
201
- ctx.unstash('getListsTokensHandlers.task_list_close');
202
- if (ctx.output.colPos !== 0) {
203
- ctx.current.log('\n');
204
- }
205
- },
206
- ],
207
- 'task_item_open': [
208
- (token, ctx) => {
209
- ctx.current.itemRow = 0;
210
- ctx.current.itemNumber++;
211
- ctx.current.itemSymbol = token.attrGet('checked') ? 'x' : '';
212
- if (ctx.output.colPos !== 0) {
213
- ctx.current.log('\n');
214
- }
215
- },
216
- ],
217
- 'task_item_close': [
218
- (token, ctx) => {
219
- if (ctx.output.colPos !== 0) {
220
- ctx.current.log('\n');
221
- }
222
- },
223
- ],
224
- 'bullet_list_open': [
225
- (token, ctx) => {
226
- ctx.stash('getListsTokensHandlers.bullet_list_open');
227
- ctx.current.listPath.push('ul');
228
- ctx.current.listType = 'ul';
229
- ctx.current.itemSymbol = '';
230
- ctx.current.itemNumber = 0;
231
- },
232
- ],
233
- 'bullet_list_close': [
234
- (token, ctx) => {
235
- ctx.unstash('getListsTokensHandlers.bullet_list_close');
236
- if (ctx.output.colPos !== 0) {
237
- ctx.current.log('\n');
238
- }
239
- },
240
- ],
241
- 'ordered_list_open': [
242
- (token, ctx) => {
243
- {
244
- ctx.stash('getListsTokensHandlers.ordered_list_open');
245
- ctx.current.listPath.push('ol');
246
- ctx.current.listType = 'ol';
247
- const htmlInlineHandlers = Object.entries(getHtmlInlineTokensHandlers())
248
- .filter((a) => [
249
- 'strong_open',
250
- 'strong_close',
251
- 'em_open',
252
- 'em_close',
253
- 'underline_open',
254
- 'underline_close',
255
- 'strike_open',
256
- 'strike_close',
257
- ].includes(a[0]));
258
- ctx.current.handlers = {
259
- ...ctx.current.handlers,
260
- ...Object.fromEntries(htmlInlineHandlers),
261
- };
262
- ctx.current.itemSymbol = '';
263
- const symbol = token.attrGet('symbol');
264
- if (symbol) {
265
- ctx.current.meta['list_symbol'] = symbol;
266
- }
267
- else {
268
- ctx.current.meta['list_symbol'] = '1';
269
- }
270
- const start = token.attrGet('start');
271
- if (start) {
272
- ctx.current.itemNumber = (+start || 1) - 1;
273
- }
274
- else {
275
- ctx.current.itemNumber = 0;
276
- }
277
- }
278
- },
279
- ],
280
- 'ordered_list_close': [
281
- (token, ctx) => {
282
- ctx.unstash('getListsTokensHandlers.ordered_list_close');
283
- if (ctx.output.colPos !== 0) {
284
- ctx.current.log('\n');
285
- }
286
- },
287
- ],
288
- 'list_item_open': [
289
- (token, ctx) => {
290
- ctx.current.itemRow = 0;
291
- ctx.current.itemNumber++;
292
- ctx.current.itemSymbol = token.info || token.markup;
293
- if (!ctx.current.itemSymbol) {
294
- ctx.current.itemSymbol = numberString(ctx.current.itemNumber, ctx.current.meta['list_symbol'] || '1');
295
- }
296
- if (ctx.output.colPos !== 0) {
297
- ctx.current.log('\n');
298
- }
299
- },
300
- ],
301
- 'list_item_close': [
302
- (token, ctx) => {
303
- if (ctx.output.colPos !== 0) {
304
- ctx.current.log('\n');
305
- }
306
- },
307
- ],
308
- 'blockquote_open': [
309
- (token, ctx) => {
310
- ctx.stash('getListsTokensHandlers.blockquote_open');
311
- ctx.current.blockquoteCnt++;
312
- if (ctx.output.colPos !== 0) {
313
- ctx.current.log('\n');
314
- }
315
- },
316
- ],
317
- 'blockquote_close': [
318
- (token, ctx) => {
319
- ctx.unstash('getListsTokensHandlers.blockquote_close');
320
- },
321
- ],
322
- };
323
- }
@@ -1,9 +0,0 @@
1
- import type { TokenHandler } from '../MarkdownSerializer.js';
2
- export type TextAlign = 'left' | 'right';
3
- export interface RollbackData {
4
- sourcePos: number;
5
- outputPos: number;
6
- ctxDepth: number;
7
- }
8
- export declare function getTableTokensHandlers(): Record<string, Array<TokenHandler>>;
9
- //# sourceMappingURL=table_token_handlers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table_token_handlers.d.ts","sourceRoot":"","sources":["../../../../src/extension-markdown/src/token_handlers/table_token_handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,0BAA0B,CAAC;AAIlC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAuNzC,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAsID,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAI5E"}
@@ -1,308 +0,0 @@
1
- import { getHtmlInlineTokensHandlers } from './inline_token_handlers.js';
2
- function getHtmlTableTokensHandlers() {
3
- return {
4
- // ...getHtmlBasicTokensHandlers(), // TODO html
5
- ...getHtmlInlineTokensHandlers(),
6
- 'paragraph_open': [],
7
- 'paragraph_close': [],
8
- 'table_open': [
9
- (token, ctx) => {
10
- ctx.stash('getHtmlTableTokensHandlers.table_open');
11
- ctx.current.meta['html_mode'] = true;
12
- ctx.current.log('<table>\n', token);
13
- },
14
- ],
15
- 'table_close': [
16
- (token, ctx) => {
17
- ctx.current.log('</table>\n', token);
18
- ctx.unstash('getHtmlTableTokensHandlers.table_close');
19
- },
20
- ],
21
- 'thead_open': [
22
- (token, ctx) => {
23
- ctx.current.log('<thead>\n', token);
24
- },
25
- ],
26
- 'thead_close': [
27
- (token, ctx) => {
28
- ctx.current.log('</thead>\n', token);
29
- },
30
- ],
31
- 'tr_open': [
32
- (token, ctx) => {
33
- ctx.current.log('<tr>\n', token);
34
- },
35
- ],
36
- 'tr_close': [
37
- (token, ctx) => {
38
- ctx.current.log('</tr>\n', token);
39
- },
40
- ],
41
- 'th_open': [
42
- (token, ctx) => {
43
- ctx.current.log('<th>', token);
44
- },
45
- ],
46
- 'th_close': [
47
- (token, ctx) => {
48
- ctx.current.log('</th>\n', token);
49
- },
50
- ],
51
- 'tbody_open': [
52
- (token, ctx) => {
53
- ctx.current.log('<tbody>\n', token);
54
- },
55
- ],
56
- 'tbody_close': [
57
- (token, ctx) => {
58
- ctx.current.log('</tbody>\n', token);
59
- },
60
- ],
61
- 'td_open': [
62
- (token, ctx) => {
63
- ctx.current.log('<td>', token);
64
- },
65
- ],
66
- 'td_close': [
67
- (token, ctx) => {
68
- ctx.current.log('</td>\n', token);
69
- },
70
- ],
71
- };
72
- }
73
- class TableBuilder {
74
- constructor() {
75
- Object.defineProperty(this, "rows", {
76
- enumerable: true,
77
- configurable: true,
78
- writable: true,
79
- value: void 0
80
- });
81
- Object.defineProperty(this, "currentType", {
82
- enumerable: true,
83
- configurable: true,
84
- writable: true,
85
- value: void 0
86
- });
87
- this.currentType = 'body';
88
- this.rows = [];
89
- }
90
- appendRow() {
91
- this.rows.push({
92
- type: this.currentType,
93
- cells: [],
94
- });
95
- }
96
- appendCell(align, token) {
97
- const lastRow = this.rows[this.rows.length - 1];
98
- const startPos = token.map && token.map.length > 0 ? token.map[0] : 0;
99
- lastRow.cells.push({
100
- value: [],
101
- startPos,
102
- align,
103
- });
104
- }
105
- appendText(content, token) {
106
- const lastRow = this.rows[this.rows.length - 1];
107
- if (lastRow.cells.length > 0) {
108
- lastRow.cells[lastRow.cells.length - 1].value.push([content, token]);
109
- }
110
- }
111
- render(log) {
112
- let prevType = '';
113
- let lastHeader = [];
114
- const columnsWidth = [];
115
- for (let rowNo = 0; rowNo < this.rows.length; rowNo++) {
116
- const row = this.rows[rowNo];
117
- for (let cellNo = 0; cellNo < row.cells.length; cellNo++) {
118
- while (columnsWidth.length <= cellNo) {
119
- columnsWidth.push(1);
120
- }
121
- const headCell = lastHeader[cellNo];
122
- const cell = row.cells[cellNo];
123
- const textLen = cell.value.reduce((prev, current) => prev + current[0].length, 0);
124
- if (columnsWidth[cellNo] < textLen + 1) {
125
- columnsWidth[cellNo] = textLen + 1;
126
- }
127
- }
128
- }
129
- for (let rowNo = 0; rowNo < this.rows.length; rowNo++) {
130
- const row = this.rows[rowNo];
131
- if (prevType === 'header' && prevType !== row.type) {
132
- log('|');
133
- for (let cellNo = 0; cellNo < lastHeader.length; cellNo++) {
134
- const cell = lastHeader[cellNo];
135
- log(' ');
136
- if (cell.align === 'right') {
137
- log('-'.repeat(columnsWidth[cellNo] - 2));
138
- log(': |');
139
- }
140
- else {
141
- log('-'.repeat(columnsWidth[cellNo] - 1));
142
- log(' |');
143
- }
144
- }
145
- log('\n');
146
- }
147
- log('|');
148
- for (let cellNo = 0; cellNo < row.cells.length; cellNo++) {
149
- const cell = row.cells[cellNo];
150
- const textLen = cell.value.reduce((prev, current) => prev + current[0].length, 0);
151
- if (cell.align === 'right') {
152
- if (textLen === 0 && cell.startPos) {
153
- log(' '.repeat(columnsWidth[cellNo] - textLen), { map: [cell.startPos + 2] });
154
- }
155
- else {
156
- log(' '.repeat(columnsWidth[cellNo] - textLen));
157
- }
158
- }
159
- else {
160
- log(' '.repeat(1));
161
- }
162
- for (const pair of cell.value) {
163
- log(pair[0], pair[1]);
164
- }
165
- if (textLen < columnsWidth[cellNo]) {
166
- if (cell.align === 'right') {
167
- log(' '.repeat(1));
168
- }
169
- else {
170
- if (textLen === 0 && cell.startPos) {
171
- log(' '.repeat(columnsWidth[cellNo] - textLen), { map: [cell.startPos + 2] });
172
- }
173
- else {
174
- log(' '.repeat(columnsWidth[cellNo] - textLen));
175
- }
176
- }
177
- }
178
- log('|');
179
- }
180
- log('\n');
181
- if (row.type === 'header') {
182
- lastHeader = row.cells;
183
- }
184
- prevType = row.type;
185
- }
186
- }
187
- }
188
- function getMdTableTokensHandler() {
189
- const rollbackMdTable = (token, ctx, tokenSource) => {
190
- if (!ctx.current.meta['html_rollback']) {
191
- throw new Error('No html_rollback');
192
- }
193
- const rollback = ctx.current.meta['html_rollback'];
194
- tokenSource.rewind(rollback.sourcePos);
195
- ctx.rollback(rollback.ctxDepth, 'rollbackMdTable, ' + token.type);
196
- ctx.output.rollback(rollback.outputPos);
197
- ctx.stash('getMdTableTokensHandler.rollbackTable');
198
- ctx.current.meta['html_mode'] = true;
199
- ctx.current.log('<table>\n', token);
200
- ctx.current.handlers = getHtmlTableTokensHandlers();
201
- };
202
- return {
203
- 'text': [
204
- (token, ctx) => {
205
- const tableBuilder = ctx.current.metaObj['table_builder'];
206
- tableBuilder.appendText(token.content, token);
207
- },
208
- ],
209
- 'paragraph_open': [],
210
- 'paragraph_close': [
211
- (token, ctx, tokenSource) => {
212
- ctx.current.meta['table_cell_para_count'] =
213
- +ctx.current.meta['table_cell_para_count'] + 1;
214
- if (ctx.current.meta['table_cell_para_count'] > 1) { // Only 1 line in markdown pipe table
215
- rollbackMdTable(token, ctx, tokenSource);
216
- }
217
- },
218
- ],
219
- 'default': [
220
- rollbackMdTable,
221
- ],
222
- 'table_open': [
223
- (token, ctx, tokenSource) => {
224
- const rollbackDepth = ctx.stash('getMdTableTokensHandler.table_open');
225
- if (!ctx.current.meta['html_rollback']) {
226
- const rollback = {
227
- sourcePos: tokenSource.pos,
228
- outputPos: ctx.output.chunkPos,
229
- ctxDepth: rollbackDepth,
230
- };
231
- ctx.current.meta['html_rollback'] = rollback;
232
- }
233
- ctx.current.metaObj['table_builder'] = new TableBuilder();
234
- ctx.current.handlers = getMdTableTokensHandler();
235
- },
236
- ],
237
- 'table_close': [
238
- (token, ctx) => {
239
- const tableBuilder = ctx.current.metaObj['table_builder'];
240
- tableBuilder.render(ctx.current.log);
241
- ctx.unstash('getMdTableTokensHandler.table_close');
242
- },
243
- ],
244
- 'thead_open': [
245
- (token, ctx) => {
246
- const tableBuilder = ctx.current.metaObj['table_builder'];
247
- tableBuilder.currentType = 'header';
248
- },
249
- ],
250
- 'thead_close': [
251
- (token, ctx) => {
252
- const tableBuilder = ctx.current.metaObj['table_builder'];
253
- tableBuilder.currentType = 'body';
254
- },
255
- ],
256
- 'tr_open': [
257
- (token, ctx) => {
258
- const tableBuilder = ctx.current.metaObj['table_builder'];
259
- tableBuilder.appendRow();
260
- },
261
- ],
262
- 'tr_close': [
263
- (token, ctx) => {
264
- },
265
- ],
266
- 'th_open': [
267
- (token, ctx) => {
268
- // const style = token.attrGet('style');
269
- // const align = style === 'text-align:right' ? 'right' : 'left';
270
- const align = token.attrGet('align') || 'left';
271
- const tableBuilder = ctx.current.metaObj['table_builder'];
272
- tableBuilder.appendCell(align, token);
273
- ctx.current.meta['table_cell_para_count'] = 0;
274
- },
275
- ],
276
- 'th_close': [
277
- (token, ctx) => {
278
- },
279
- ],
280
- 'tbody_open': [
281
- (token, ctx) => {
282
- const tableBuilder = ctx.current.metaObj['table_builder'];
283
- tableBuilder.currentType = 'body';
284
- },
285
- ],
286
- 'tbody_close': [
287
- (token, ctx) => {
288
- },
289
- ],
290
- 'td_open': [
291
- (token, ctx) => {
292
- const align = token.attrGet('align') || 'left';
293
- const tableBuilder = ctx.current.metaObj['table_builder'];
294
- tableBuilder.appendCell(align, token);
295
- ctx.current.meta['table_cell_para_count'] = 0;
296
- },
297
- ],
298
- 'td_close': [
299
- (token, ctx) => {
300
- },
301
- ],
302
- };
303
- }
304
- export function getTableTokensHandlers() {
305
- return {
306
- 'table_open': getMdTableTokensHandler()['table_open'],
307
- };
308
- }
@@ -1,5 +0,0 @@
1
- import { Token } from './types.js';
2
- export declare function sitterTokenizer(cdnUrl?: string): Promise<{
3
- parse: (source: string) => Array<Token>;
4
- }>;
5
- //# sourceMappingURL=treeSitterTokenizer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"treeSitterTokenizer.d.ts","sourceRoot":"","sources":["../../../src/extension-markdown/src/treeSitterTokenizer.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,EACN,MAAM,YAAY,CAAC;AA4kCpB,wBAAsB,eAAe,CAAC,MAAM,SAAK;oBAkB7B,MAAM,KAAG,KAAK,CAAC,KAAK,CAAC;GASxC"}