react-native-nitro-markdown 0.1.2 → 0.3.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 (238) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +293 -119
  3. package/android/src/main/cpp/cpp-adapter.cpp +1 -1
  4. package/android/src/main/java/com/margelo/nitro/com/nitromarkdown/HybridMarkdownSession.kt +61 -0
  5. package/android/src/main/java/com/nitromarkdown/NitroMarkdownPackage.kt +5 -1
  6. package/cpp/bindings/HybridMarkdownParser.cpp +2 -2
  7. package/cpp/bindings/HybridMarkdownParser.hpp +2 -2
  8. package/cpp/bindings/HybridMarkdownSession.cpp +0 -0
  9. package/cpp/core/MarkdownSessionCore.cpp +0 -0
  10. package/ios/HybridMarkdownSession.swift +64 -0
  11. package/lib/commonjs/MarkdownContext.js +17 -0
  12. package/lib/commonjs/MarkdownContext.js.map +1 -0
  13. package/lib/commonjs/MarkdownSession.js +11 -0
  14. package/lib/commonjs/MarkdownSession.js.map +1 -0
  15. package/lib/commonjs/default-markdown-renderer.js +217 -0
  16. package/lib/commonjs/default-markdown-renderer.js.map +1 -0
  17. package/lib/commonjs/headless.js +61 -0
  18. package/lib/commonjs/headless.js.map +1 -0
  19. package/lib/commonjs/index.js +220 -13
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/markdown-stream.js +32 -0
  22. package/lib/commonjs/markdown-stream.js.map +1 -0
  23. package/lib/commonjs/markdown.js +377 -0
  24. package/lib/commonjs/markdown.js.map +1 -0
  25. package/lib/commonjs/package.json +1 -0
  26. package/lib/commonjs/renderers/blockquote.js +36 -0
  27. package/lib/commonjs/renderers/blockquote.js.map +1 -0
  28. package/lib/commonjs/renderers/code.js +99 -0
  29. package/lib/commonjs/renderers/code.js.map +1 -0
  30. package/lib/commonjs/renderers/heading.js +63 -0
  31. package/lib/commonjs/renderers/heading.js.map +1 -0
  32. package/lib/commonjs/renderers/horizontal-rule.js +29 -0
  33. package/lib/commonjs/renderers/horizontal-rule.js.map +1 -0
  34. package/lib/commonjs/renderers/image.js +163 -0
  35. package/lib/commonjs/renderers/image.js.map +1 -0
  36. package/lib/commonjs/renderers/link.js +35 -0
  37. package/lib/commonjs/renderers/link.js.map +1 -0
  38. package/lib/commonjs/renderers/list.js +118 -0
  39. package/lib/commonjs/renderers/list.js.map +1 -0
  40. package/lib/commonjs/renderers/math.js +127 -0
  41. package/lib/commonjs/renderers/math.js.map +1 -0
  42. package/lib/commonjs/renderers/paragraph.js +39 -0
  43. package/lib/commonjs/renderers/paragraph.js.map +1 -0
  44. package/lib/commonjs/renderers/table.js +290 -0
  45. package/lib/commonjs/renderers/table.js.map +1 -0
  46. package/lib/commonjs/specs/MarkdownSession.nitro.js +6 -0
  47. package/lib/commonjs/specs/MarkdownSession.nitro.js.map +1 -0
  48. package/lib/commonjs/theme.js +191 -0
  49. package/lib/commonjs/theme.js.map +1 -0
  50. package/lib/commonjs/use-markdown-stream.js +71 -0
  51. package/lib/commonjs/use-markdown-stream.js.map +1 -0
  52. package/lib/module/MarkdownContext.js +12 -0
  53. package/lib/module/MarkdownContext.js.map +1 -0
  54. package/lib/module/MarkdownSession.js +7 -0
  55. package/lib/module/MarkdownSession.js.map +1 -0
  56. package/lib/module/default-markdown-renderer.js +212 -0
  57. package/lib/module/default-markdown-renderer.js.map +1 -0
  58. package/lib/module/headless.js +54 -0
  59. package/lib/module/headless.js.map +1 -0
  60. package/lib/module/index.js +18 -10
  61. package/lib/module/index.js.map +1 -1
  62. package/lib/module/markdown-stream.js +27 -0
  63. package/lib/module/markdown-stream.js.map +1 -0
  64. package/lib/module/markdown.js +372 -0
  65. package/lib/module/markdown.js.map +1 -0
  66. package/lib/module/package.json +1 -0
  67. package/lib/module/renderers/blockquote.js +31 -0
  68. package/lib/module/renderers/blockquote.js.map +1 -0
  69. package/lib/module/renderers/code.js +93 -0
  70. package/lib/module/renderers/code.js.map +1 -0
  71. package/lib/module/renderers/heading.js +58 -0
  72. package/lib/module/renderers/heading.js.map +1 -0
  73. package/lib/module/renderers/horizontal-rule.js +24 -0
  74. package/lib/module/renderers/horizontal-rule.js.map +1 -0
  75. package/lib/module/renderers/image.js +158 -0
  76. package/lib/module/renderers/image.js.map +1 -0
  77. package/lib/module/renderers/link.js +30 -0
  78. package/lib/module/renderers/link.js.map +1 -0
  79. package/lib/module/renderers/list.js +111 -0
  80. package/lib/module/renderers/list.js.map +1 -0
  81. package/lib/module/renderers/math.js +121 -0
  82. package/lib/module/renderers/math.js.map +1 -0
  83. package/lib/module/renderers/paragraph.js +34 -0
  84. package/lib/module/renderers/paragraph.js.map +1 -0
  85. package/lib/module/renderers/table.js +285 -0
  86. package/lib/module/renderers/table.js.map +1 -0
  87. package/lib/module/specs/MarkdownSession.nitro.js +4 -0
  88. package/lib/module/specs/MarkdownSession.nitro.js.map +1 -0
  89. package/lib/module/theme.js +186 -0
  90. package/lib/module/theme.js.map +1 -0
  91. package/lib/module/use-markdown-stream.js +66 -0
  92. package/lib/module/use-markdown-stream.js.map +1 -0
  93. package/lib/typescript/commonjs/Markdown.nitro.d.ts.map +1 -0
  94. package/lib/typescript/commonjs/MarkdownContext.d.ts +65 -0
  95. package/lib/typescript/commonjs/MarkdownContext.d.ts.map +1 -0
  96. package/lib/typescript/commonjs/MarkdownSession.d.ts +4 -0
  97. package/lib/typescript/commonjs/MarkdownSession.d.ts.map +1 -0
  98. package/lib/typescript/commonjs/default-markdown-renderer.d.ts +10 -0
  99. package/lib/typescript/commonjs/default-markdown-renderer.d.ts.map +1 -0
  100. package/lib/typescript/commonjs/headless.d.ts +57 -0
  101. package/lib/typescript/commonjs/headless.d.ts.map +1 -0
  102. package/lib/typescript/commonjs/index.d.ts +22 -0
  103. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  104. package/lib/typescript/commonjs/markdown-stream.d.ts +15 -0
  105. package/lib/typescript/commonjs/markdown-stream.d.ts.map +1 -0
  106. package/lib/typescript/commonjs/markdown.d.ts +47 -0
  107. package/lib/typescript/commonjs/markdown.d.ts.map +1 -0
  108. package/lib/typescript/commonjs/package.json +1 -0
  109. package/lib/typescript/commonjs/renderers/blockquote.d.ts +9 -0
  110. package/lib/typescript/commonjs/renderers/blockquote.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/renderers/code.d.ts +19 -0
  112. package/lib/typescript/commonjs/renderers/code.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/renderers/heading.d.ts +10 -0
  114. package/lib/typescript/commonjs/renderers/heading.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/renderers/horizontal-rule.d.ts +8 -0
  116. package/lib/typescript/commonjs/renderers/horizontal-rule.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/renderers/image.d.ts +13 -0
  118. package/lib/typescript/commonjs/renderers/image.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/renderers/link.d.ts +10 -0
  120. package/lib/typescript/commonjs/renderers/link.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/renderers/list.d.ts +26 -0
  122. package/lib/typescript/commonjs/renderers/list.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/renderers/math.d.ts +14 -0
  124. package/lib/typescript/commonjs/renderers/math.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/renderers/paragraph.d.ts +10 -0
  126. package/lib/typescript/commonjs/renderers/paragraph.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/renderers/table.d.ts +12 -0
  128. package/lib/typescript/commonjs/renderers/table.d.ts.map +1 -0
  129. package/lib/typescript/commonjs/specs/MarkdownSession.nitro.d.ts +12 -0
  130. package/lib/typescript/commonjs/specs/MarkdownSession.nitro.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/theme.d.ts +65 -0
  132. package/lib/typescript/commonjs/theme.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/use-markdown-stream.d.ts +22 -0
  134. package/lib/typescript/commonjs/use-markdown-stream.d.ts.map +1 -0
  135. package/lib/typescript/module/Markdown.nitro.d.ts +13 -0
  136. package/lib/typescript/module/Markdown.nitro.d.ts.map +1 -0
  137. package/lib/typescript/module/MarkdownContext.d.ts +65 -0
  138. package/lib/typescript/module/MarkdownContext.d.ts.map +1 -0
  139. package/lib/typescript/module/MarkdownSession.d.ts +4 -0
  140. package/lib/typescript/module/MarkdownSession.d.ts.map +1 -0
  141. package/lib/typescript/module/default-markdown-renderer.d.ts +10 -0
  142. package/lib/typescript/module/default-markdown-renderer.d.ts.map +1 -0
  143. package/lib/typescript/module/headless.d.ts +57 -0
  144. package/lib/typescript/module/headless.d.ts.map +1 -0
  145. package/lib/typescript/module/index.d.ts +22 -0
  146. package/lib/typescript/module/index.d.ts.map +1 -0
  147. package/lib/typescript/module/markdown-stream.d.ts +15 -0
  148. package/lib/typescript/module/markdown-stream.d.ts.map +1 -0
  149. package/lib/typescript/module/markdown.d.ts +47 -0
  150. package/lib/typescript/module/markdown.d.ts.map +1 -0
  151. package/lib/typescript/module/package.json +1 -0
  152. package/lib/typescript/module/renderers/blockquote.d.ts +9 -0
  153. package/lib/typescript/module/renderers/blockquote.d.ts.map +1 -0
  154. package/lib/typescript/module/renderers/code.d.ts +19 -0
  155. package/lib/typescript/module/renderers/code.d.ts.map +1 -0
  156. package/lib/typescript/module/renderers/heading.d.ts +10 -0
  157. package/lib/typescript/module/renderers/heading.d.ts.map +1 -0
  158. package/lib/typescript/module/renderers/horizontal-rule.d.ts +8 -0
  159. package/lib/typescript/module/renderers/horizontal-rule.d.ts.map +1 -0
  160. package/lib/typescript/module/renderers/image.d.ts +13 -0
  161. package/lib/typescript/module/renderers/image.d.ts.map +1 -0
  162. package/lib/typescript/module/renderers/link.d.ts +10 -0
  163. package/lib/typescript/module/renderers/link.d.ts.map +1 -0
  164. package/lib/typescript/module/renderers/list.d.ts +26 -0
  165. package/lib/typescript/module/renderers/list.d.ts.map +1 -0
  166. package/lib/typescript/module/renderers/math.d.ts +14 -0
  167. package/lib/typescript/module/renderers/math.d.ts.map +1 -0
  168. package/lib/typescript/module/renderers/paragraph.d.ts +10 -0
  169. package/lib/typescript/module/renderers/paragraph.d.ts.map +1 -0
  170. package/lib/typescript/module/renderers/table.d.ts +12 -0
  171. package/lib/typescript/module/renderers/table.d.ts.map +1 -0
  172. package/lib/typescript/module/specs/MarkdownSession.nitro.d.ts +12 -0
  173. package/lib/typescript/module/specs/MarkdownSession.nitro.d.ts.map +1 -0
  174. package/lib/typescript/module/theme.d.ts +65 -0
  175. package/lib/typescript/module/theme.d.ts.map +1 -0
  176. package/lib/typescript/module/use-markdown-stream.d.ts +22 -0
  177. package/lib/typescript/module/use-markdown-stream.d.ts.map +1 -0
  178. package/nitro.json +5 -2
  179. package/nitrogen/generated/android/NitroMarkdown+autolinking.cmake +3 -2
  180. package/nitrogen/generated/android/NitroMarkdown+autolinking.gradle +1 -1
  181. package/nitrogen/generated/android/NitroMarkdownOnLoad.cpp +17 -5
  182. package/nitrogen/generated/android/NitroMarkdownOnLoad.hpp +4 -4
  183. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  184. package/nitrogen/generated/android/c++/JHybridMarkdownSessionSpec.cpp +91 -0
  185. package/nitrogen/generated/android/c++/JHybridMarkdownSessionSpec.hpp +70 -0
  186. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/Func_void.kt +80 -0
  187. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/HybridMarkdownSessionSpec.kt +78 -0
  188. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/NitroMarkdownOnLoad.kt +1 -1
  189. package/nitrogen/generated/ios/NitroMarkdown+autolinking.rb +2 -2
  190. package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Bridge.cpp +28 -4
  191. package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Bridge.hpp +72 -6
  192. package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Umbrella.hpp +11 -4
  193. package/nitrogen/generated/ios/NitroMarkdownAutolinking.mm +11 -3
  194. package/nitrogen/generated/ios/NitroMarkdownAutolinking.swift +16 -3
  195. package/nitrogen/generated/ios/c++/HybridMarkdownSessionSpecSwift.cpp +11 -0
  196. package/nitrogen/generated/ios/c++/HybridMarkdownSessionSpecSwift.hpp +108 -0
  197. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  198. package/nitrogen/generated/ios/swift/HybridMarkdownSessionSpec.swift +59 -0
  199. package/nitrogen/generated/ios/swift/HybridMarkdownSessionSpec_cxx.swift +190 -0
  200. package/nitrogen/generated/shared/c++/HybridMarkdownParserSpec.cpp +3 -3
  201. package/nitrogen/generated/shared/c++/HybridMarkdownParserSpec.hpp +4 -4
  202. package/nitrogen/generated/shared/c++/HybridMarkdownSessionSpec.cpp +26 -0
  203. package/nitrogen/generated/shared/c++/HybridMarkdownSessionSpec.hpp +67 -0
  204. package/nitrogen/generated/shared/c++/ParserOptions.hpp +22 -14
  205. package/package.json +45 -7
  206. package/react-native-nitro-markdown.podspec +5 -5
  207. package/src/MarkdownContext.ts +98 -0
  208. package/src/MarkdownSession.ts +8 -0
  209. package/src/default-markdown-renderer.tsx +261 -0
  210. package/src/headless.ts +116 -0
  211. package/src/index.ts +47 -60
  212. package/src/markdown-stream.tsx +32 -0
  213. package/src/markdown.tsx +497 -0
  214. package/src/renderers/blockquote.tsx +30 -0
  215. package/src/renderers/code.tsx +112 -0
  216. package/src/renderers/heading.tsx +66 -0
  217. package/src/renderers/horizontal-rule.tsx +23 -0
  218. package/src/renderers/image.tsx +175 -0
  219. package/src/renderers/link.tsx +33 -0
  220. package/src/renderers/list.tsx +131 -0
  221. package/src/renderers/math.tsx +141 -0
  222. package/src/renderers/paragraph.tsx +47 -0
  223. package/src/renderers/table.tsx +370 -0
  224. package/src/specs/MarkdownSession.nitro.ts +16 -0
  225. package/src/theme.ts +243 -0
  226. package/src/use-markdown-stream.ts +83 -0
  227. package/ios/NitroMarkdown-Bridging-Header.h +0 -14
  228. package/lib/commonjs/MarkdownJS.reference.js +0 -114
  229. package/lib/commonjs/MarkdownJS.reference.js.map +0 -1
  230. package/lib/module/MarkdownJS.reference.js +0 -107
  231. package/lib/module/MarkdownJS.reference.js.map +0 -1
  232. package/lib/typescript/Markdown.nitro.d.ts.map +0 -1
  233. package/lib/typescript/MarkdownJS.reference.d.ts +0 -33
  234. package/lib/typescript/MarkdownJS.reference.d.ts.map +0 -1
  235. package/lib/typescript/index.d.ts +0 -22
  236. package/lib/typescript/index.d.ts.map +0 -1
  237. package/src/MarkdownJS.reference.ts +0 -122
  238. /package/lib/typescript/{Markdown.nitro.d.ts → commonjs/Markdown.nitro.d.ts} +0 -0
@@ -0,0 +1,57 @@
1
+ import type { MarkdownParser, ParserOptions } from "./Markdown.nitro";
2
+ export type { ParserOptions } from "./Markdown.nitro";
3
+ /**
4
+ * Represents a node in the Markdown AST (Abstract Syntax Tree).
5
+ * Each node has a type and optional properties depending on the node type.
6
+ */
7
+ export interface MarkdownNode {
8
+ /** The type of markdown element this node represents. Used to decide how to render the node. */
9
+ type: "document" | "heading" | "paragraph" | "text" | "bold" | "italic" | "strikethrough" | "link" | "image" | "code_inline" | "code_block" | "blockquote" | "horizontal_rule" | "line_break" | "soft_break" | "table" | "table_head" | "table_body" | "table_row" | "table_cell" | "list" | "list_item" | "task_list_item" | "math_inline" | "math_block" | "html_block" | "html_inline";
10
+ /** Text content for text, code, and similar nodes. */
11
+ content?: string;
12
+ /** Heading level (1-6) for heading nodes. */
13
+ level?: number;
14
+ /** URL for link and image nodes. */
15
+ href?: string;
16
+ /** Title attribute for link and image nodes. */
17
+ title?: string;
18
+ /** Alt text for image nodes. */
19
+ alt?: string;
20
+ /** Programming language for code blocks (e.g., 'typescript', 'javascript'). */
21
+ language?: string;
22
+ /** Whether a list is ordered (numbered) or unordered. */
23
+ ordered?: boolean;
24
+ /** The starting number for ordered lists. */
25
+ start?: number;
26
+ /** Whether a task list item is currently checked. */
27
+ checked?: boolean;
28
+ /** Whether a table cell is part of the header row. */
29
+ isHeader?: boolean;
30
+ /** Text alignment for table cells: 'left', 'center', or 'right'. */
31
+ align?: string;
32
+ /** Nested child nodes for hierarchical elements like paragraphs, lists, and tables. */
33
+ children?: MarkdownNode[];
34
+ }
35
+ export declare const MarkdownParserModule: MarkdownParser;
36
+ /**
37
+ * Parse markdown text into an AST.
38
+ * @param text - The markdown text to parse
39
+ * @returns The root node of the parsed AST
40
+ */
41
+ export declare function parseMarkdown(text: string): MarkdownNode;
42
+ /**
43
+ * Parse markdown text with custom options.
44
+ * @param text - The markdown text to parse
45
+ * @param options - Parser options (gfm, math)
46
+ * @returns The root node of the parsed AST
47
+ */
48
+ export declare function parseMarkdownWithOptions(text: string, options: ParserOptions): MarkdownNode;
49
+ export type { MarkdownParser };
50
+ /**
51
+ * Extract text content from a markdown node recursively.
52
+ * Useful for getting plain text from code blocks, headings, etc.
53
+ * @param node - The markdown node to extract text from
54
+ * @returns The concatenated text content
55
+ */
56
+ export declare const getTextContent: (node: MarkdownNode) => string;
57
+ //# sourceMappingURL=headless.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headless.d.ts","sourceRoot":"","sources":["../../../src/headless.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,gGAAgG;IAChG,IAAI,EACA,UAAU,GACV,SAAS,GACT,WAAW,GACX,MAAM,GACN,MAAM,GACN,QAAQ,GACR,eAAe,GACf,MAAM,GACN,OAAO,GACP,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,iBAAiB,GACjB,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,MAAM,GACN,WAAW,GACX,gBAAgB,GAChB,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,aAAa,CAAC;IAClB,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,oBAAoB,gBACkC,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAGxD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,aAAa,GACrB,YAAY,CAGd;AAED,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,YAAY,KAAG,MAGnD,CAAC"}
@@ -0,0 +1,22 @@
1
+ export * from "./headless";
2
+ export { DefaultMarkdownRenderer } from "./default-markdown-renderer";
3
+ export { Markdown } from "./markdown";
4
+ export { MarkdownStream } from "./markdown-stream";
5
+ export { useMarkdownContext, MarkdownContext } from "./MarkdownContext";
6
+ export type { CustomRenderer, CustomRenderers, CustomRendererProps, NodeRendererProps, BaseCustomRendererProps, EnhancedRendererProps, HeadingRendererProps, LinkRendererProps, ImageRendererProps, CodeBlockRendererProps, InlineCodeRendererProps, ListRendererProps, TaskListItemRendererProps, MarkdownContextValue, } from "./MarkdownContext";
7
+ export { defaultMarkdownTheme, lightMarkdownTheme, darkMarkdownTheme, minimalMarkdownTheme, mergeThemes, } from "./theme";
8
+ export type { MarkdownTheme, PartialMarkdownTheme, NodeStyleOverrides, StylingStrategy, } from "./theme";
9
+ export { Heading } from "./renderers/heading";
10
+ export { Paragraph } from "./renderers/paragraph";
11
+ export { Link } from "./renderers/link";
12
+ export { Blockquote } from "./renderers/blockquote";
13
+ export { HorizontalRule } from "./renderers/horizontal-rule";
14
+ export { CodeBlock, InlineCode } from "./renderers/code";
15
+ export { List, ListItem, TaskListItem } from "./renderers/list";
16
+ export { TableRenderer } from "./renderers/table";
17
+ export { Image } from "./renderers/image";
18
+ export { MathInline, MathBlock } from "./renderers/math";
19
+ export { createMarkdownSession } from "./MarkdownSession";
20
+ export type { MarkdownSession } from "./MarkdownSession";
21
+ export { useMarkdownSession, useStream } from "./use-markdown-stream";
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACxE,YAAY,EACV,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type FC } from "react";
2
+ import { type MarkdownProps } from "./markdown";
3
+ import type { MarkdownSession } from "./specs/MarkdownSession.nitro";
4
+ export interface MarkdownStreamProps extends Omit<MarkdownProps, "children"> {
5
+ /**
6
+ * The active MarkdownSession to stream content from.
7
+ */
8
+ session: MarkdownSession;
9
+ }
10
+ /**
11
+ * A component that renders streaming Markdown from a MarkdownSession.
12
+ * It efficiently subscribes to session updates to minimize parent re-renders.
13
+ */
14
+ export declare const MarkdownStream: FC<MarkdownStreamProps>;
15
+ //# sourceMappingURL=markdown-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-stream.d.ts","sourceRoot":"","sources":["../../../src/markdown-stream.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;IAC1E;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAgBlD,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { type PartialMarkdownTheme, type NodeStyleOverrides, type StylingStrategy } from "./theme";
2
+ import { type FC } from "react";
3
+ import { type StyleProp, type ViewStyle } from "react-native";
4
+ import type { ParserOptions } from "./Markdown.nitro";
5
+ import { type CustomRenderers } from "./MarkdownContext";
6
+ export interface MarkdownProps {
7
+ /**
8
+ * The markdown string to parse and render.
9
+ */
10
+ children: string;
11
+ /**
12
+ * Parser options to enable GFM or Math support.
13
+ */
14
+ options?: ParserOptions;
15
+ /**
16
+ * Custom renderers for specific markdown node types.
17
+ * Each renderer receives { node, children, Renderer } plus type-specific props.
18
+ */
19
+ renderers?: CustomRenderers;
20
+ /**
21
+ * Custom theme to override default styles.
22
+ */
23
+ theme?: PartialMarkdownTheme;
24
+ /**
25
+ * Style overrides for specific node types.
26
+ * Applied after internal styles, allowing fine-grained customization.
27
+ * @example
28
+ * ```tsx
29
+ * <Markdown styles={{ heading: { color: 'red' }, code_block: { borderRadius: 0 } }}>
30
+ * {content}
31
+ * </Markdown>
32
+ * ```
33
+ */
34
+ styles?: NodeStyleOverrides;
35
+ /**
36
+ * Styling strategy for the component.
37
+ * - "opinionated": Full styling with colors, spacing, and visual effects (default)
38
+ * - "minimal": Bare minimum styling for a clean slate
39
+ */
40
+ stylingStrategy?: StylingStrategy;
41
+ /**
42
+ * Optional style for the container view.
43
+ */
44
+ style?: StyleProp<ViewStyle>;
45
+ }
46
+ export declare const Markdown: FC<MarkdownProps>;
47
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAA2B,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AACnE,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,mBAAmB,CAAC;AAa3B,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B;;;;OAIG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAgDtC,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,9 @@
1
+ import { ReactNode, type FC } from "react";
2
+ import { type ViewStyle } from "react-native";
3
+ interface BlockquoteProps {
4
+ children: ReactNode;
5
+ style?: ViewStyle;
6
+ }
7
+ export declare const Blockquote: FC<BlockquoteProps>;
8
+ export {};
9
+ //# sourceMappingURL=blockquote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockquote.d.ts","sourceRoot":"","sources":["../../../../src/renderers/blockquote.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhE,UAAU,eAAe;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAoB1C,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { ReactNode, type FC } from "react";
2
+ import { type ViewStyle, type TextStyle } from "react-native";
3
+ import type { MarkdownNode } from "../headless";
4
+ interface CodeBlockProps {
5
+ language?: string;
6
+ content?: string;
7
+ node?: MarkdownNode;
8
+ style?: ViewStyle;
9
+ }
10
+ export declare const CodeBlock: FC<CodeBlockProps>;
11
+ interface InlineCodeProps {
12
+ content?: string;
13
+ node?: MarkdownNode;
14
+ children?: ReactNode;
15
+ style?: TextStyle;
16
+ }
17
+ export declare const InlineCode: FC<InlineCodeProps>;
18
+ export {};
19
+ //# sourceMappingURL=code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../../../src/renderers/code.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAML,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,UAAU,cAAc;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAmDxC,CAAC;AAEF,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA8B1C,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ReactNode, type FC } from "react";
2
+ import { type TextStyle } from "react-native";
3
+ interface HeadingProps {
4
+ level: number;
5
+ children: ReactNode;
6
+ style?: TextStyle;
7
+ }
8
+ export declare const Heading: FC<HeadingProps>;
9
+ export {};
10
+ //# sourceMappingURL=heading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../../../src/renderers/heading.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhE,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAuDpC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type FC } from "react";
2
+ import { type ViewStyle } from "react-native";
3
+ interface HorizontalRuleProps {
4
+ style?: ViewStyle;
5
+ }
6
+ export declare const HorizontalRule: FC<HorizontalRuleProps>;
7
+ export {};
8
+ //# sourceMappingURL=horizontal-rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"horizontal-rule.d.ts","sourceRoot":"","sources":["../../../../src/renderers/horizontal-rule.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhE,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAclD,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type FC, type ComponentType } from "react";
2
+ import { type ViewStyle } from "react-native";
3
+ import type { NodeRendererProps } from "../MarkdownContext";
4
+ interface ImageProps {
5
+ url: string;
6
+ title?: string;
7
+ alt?: string;
8
+ Renderer?: ComponentType<NodeRendererProps>;
9
+ style?: ViewStyle;
10
+ }
11
+ export declare const Image: FC<ImageProps>;
12
+ export {};
13
+ //# sourceMappingURL=image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../src/renderers/image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,EAAE,EACP,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AACf,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAmB5D,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAmIhC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ReactNode, type FC } from "react";
2
+ import { type TextStyle } from "react-native";
3
+ interface LinkProps {
4
+ href: string;
5
+ children: ReactNode;
6
+ style?: TextStyle;
7
+ }
8
+ export declare const Link: FC<LinkProps>;
9
+ export {};
10
+ //# sourceMappingURL=link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../src/renderers/link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzE,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAsB9B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { ReactNode, type FC } from "react";
2
+ import { type ViewStyle } from "react-native";
3
+ interface ListProps {
4
+ ordered: boolean;
5
+ start?: number;
6
+ depth: number;
7
+ children: ReactNode;
8
+ style?: ViewStyle;
9
+ }
10
+ export declare const List: FC<ListProps>;
11
+ interface ListItemProps {
12
+ children: ReactNode;
13
+ index: number;
14
+ ordered: boolean;
15
+ start: number;
16
+ style?: ViewStyle;
17
+ }
18
+ export declare const ListItem: FC<ListItemProps>;
19
+ interface TaskListItemProps {
20
+ children: ReactNode;
21
+ checked: boolean;
22
+ style?: ViewStyle;
23
+ }
24
+ export declare const TaskListItem: FC<TaskListItemProps>;
25
+ export {};
26
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/renderers/list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGtE,UAAU,SAAS;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CA0B9B,CAAC;AAEF,UAAU,aAAa;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAwCtC,CAAC;AAEF,UAAU,iBAAiB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAkC9C,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type FC } from "react";
2
+ import { type ViewStyle } from "react-native";
3
+ interface MathInlineProps {
4
+ content?: string;
5
+ style?: ViewStyle;
6
+ }
7
+ export declare const MathInline: FC<MathInlineProps>;
8
+ interface MathBlockProps {
9
+ content?: string;
10
+ style?: ViewStyle;
11
+ }
12
+ export declare const MathBlock: FC<MathBlockProps>;
13
+ export {};
14
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../../src/renderers/math.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AAC7D,OAAO,EAML,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAoBtB,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAmDD,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA0B1C,CAAC;AAEF,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAyBxC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ReactNode, type FC } from "react";
2
+ import { type StyleProp, type ViewStyle } from "react-native";
3
+ interface ParagraphProps {
4
+ children: ReactNode;
5
+ inListItem?: boolean;
6
+ style?: StyleProp<ViewStyle>;
7
+ }
8
+ export declare const Paragraph: FC<ParagraphProps>;
9
+ export {};
10
+ //# sourceMappingURL=paragraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../../src/renderers/paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhF,UAAU,cAAc;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAoCxC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type FC, type ComponentType } from "react";
2
+ import { type ViewStyle } from "react-native";
3
+ import type { MarkdownNode } from "../headless";
4
+ import { type NodeRendererProps } from "../MarkdownContext";
5
+ interface TableRendererProps {
6
+ node: MarkdownNode;
7
+ Renderer: ComponentType<NodeRendererProps>;
8
+ style?: ViewStyle;
9
+ }
10
+ export declare const TableRenderer: FC<TableRendererProps>;
11
+ export {};
12
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/renderers/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,EAAE,EACP,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAC;AACf,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAwChF,UAAU,kBAAkB;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAYD,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAmLhD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { HybridObject } from "react-native-nitro-modules";
2
+ export interface MarkdownSession extends HybridObject<{
3
+ ios: "swift";
4
+ android: "kotlin";
5
+ }> {
6
+ append(chunk: string): void;
7
+ clear(): void;
8
+ getAllText(): string;
9
+ highlightPosition: number;
10
+ addListener(listener: () => void): () => void;
11
+ }
12
+ //# sourceMappingURL=MarkdownSession.nitro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownSession.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/MarkdownSession.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,eACf,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;IAEzD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,IAAI,IAAI,CAAC;IACd,UAAU,IAAI,MAAM,CAAC;IAIrB,iBAAiB,EAAE,MAAM,CAAC;IAG1B,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC/C"}
@@ -0,0 +1,65 @@
1
+ import type { TextStyle, ViewStyle } from "react-native";
2
+ import type { MarkdownNode } from "./headless";
3
+ export interface MarkdownTheme {
4
+ colors: {
5
+ text: string | undefined;
6
+ textMuted: string | undefined;
7
+ heading: string | undefined;
8
+ link: string | undefined;
9
+ code: string | undefined;
10
+ codeBackground: string | undefined;
11
+ codeLanguage: string | undefined;
12
+ blockquote: string | undefined;
13
+ border: string | undefined;
14
+ surface: string | undefined;
15
+ surfaceLight: string | undefined;
16
+ accent: string | undefined;
17
+ tableBorder: string | undefined;
18
+ tableHeader: string | undefined;
19
+ tableHeaderText: string | undefined;
20
+ tableRowEven: string | undefined;
21
+ tableRowOdd: string | undefined;
22
+ };
23
+ spacing: {
24
+ xs: number;
25
+ s: number;
26
+ m: number;
27
+ l: number;
28
+ xl: number;
29
+ };
30
+ fontSizes: {
31
+ xs: number;
32
+ s: number;
33
+ m: number;
34
+ l: number;
35
+ xl: number;
36
+ h1: number;
37
+ h2: number;
38
+ h3: number;
39
+ h4: number;
40
+ h5: number;
41
+ h6: number;
42
+ };
43
+ fontFamilies: {
44
+ regular: string | undefined;
45
+ heading: string | undefined;
46
+ mono: string | undefined;
47
+ };
48
+ borderRadius: {
49
+ s: number;
50
+ m: number;
51
+ l: number;
52
+ };
53
+ showCodeLanguage: boolean;
54
+ }
55
+ export declare const defaultMarkdownTheme: MarkdownTheme;
56
+ export type PartialMarkdownTheme = {
57
+ [K in keyof MarkdownTheme]?: K extends "showCodeLanguage" ? MarkdownTheme[K] : Partial<MarkdownTheme[K]>;
58
+ };
59
+ export type NodeStyleOverrides = Partial<Record<MarkdownNode["type"], ViewStyle | TextStyle>>;
60
+ export type StylingStrategy = "opinionated" | "minimal";
61
+ export declare const minimalMarkdownTheme: MarkdownTheme;
62
+ export declare const lightMarkdownTheme: MarkdownTheme;
63
+ export declare const darkMarkdownTheme: MarkdownTheme;
64
+ export declare const mergeThemes: (base: MarkdownTheme, partial?: PartialMarkdownTheme) => MarkdownTheme;
65
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/theme.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,22 @@
1
+ import { createMarkdownSession } from "./MarkdownSession";
2
+ export type MarkdownSession = ReturnType<typeof createMarkdownSession>;
3
+ export declare function useMarkdownSession(): {
4
+ getSession: () => import("./specs/MarkdownSession.nitro").MarkdownSession;
5
+ isStreaming: boolean;
6
+ setIsStreaming: import("react").Dispatch<import("react").SetStateAction<boolean>>;
7
+ stop: () => void;
8
+ clear: () => void;
9
+ setHighlight: (position: number) => void;
10
+ };
11
+ export declare function useStream(timestamps?: Record<number, number>): {
12
+ isPlaying: boolean;
13
+ setIsPlaying: import("react").Dispatch<import("react").SetStateAction<boolean>>;
14
+ sync: (currentTimeMs: number) => void;
15
+ getSession: () => import("./specs/MarkdownSession.nitro").MarkdownSession;
16
+ isStreaming: boolean;
17
+ setIsStreaming: import("react").Dispatch<import("react").SetStateAction<boolean>>;
18
+ stop: () => void;
19
+ clear: () => void;
20
+ setHighlight: (position: number) => void;
21
+ };
22
+ //# sourceMappingURL=use-markdown-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-markdown-stream.d.ts","sourceRoot":"","sources":["../../../src/use-markdown-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEvE,wBAAgB,kBAAkB;;;;;;6BAyBY,MAAM;EAcnD;AAED,wBAAgB,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;0BAczC,MAAM;;;;;;6BA9BoB,MAAM;EAoDnD"}
package/nitro.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "cxxNamespace": ["NitroMarkdown"],
2
+ "cxxNamespace": ["Markdown"],
3
3
  "ios": {
4
4
  "iosModuleName": "NitroMarkdown"
5
5
  },
@@ -10,7 +10,10 @@
10
10
  "autolinking": {
11
11
  "MarkdownParser": {
12
12
  "cpp": "HybridMarkdownParser"
13
+ },
14
+ "MarkdownSession": {
15
+ "swift": "HybridMarkdownSession",
16
+ "kotlin": "HybridMarkdownSession"
13
17
  }
14
18
  }
15
19
  }
16
-
@@ -2,7 +2,7 @@
2
2
  # NitroMarkdown+autolinking.cmake
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  # https://github.com/mrousavy/nitro
5
- # Copyright © 2025 Marc Rousavy @ Margelo
5
+ # Copyright © Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a CMake file that adds all files generated by Nitrogen
@@ -34,8 +34,9 @@ target_sources(
34
34
  ../nitrogen/generated/android/NitroMarkdownOnLoad.cpp
35
35
  # Shared Nitrogen C++ sources
36
36
  ../nitrogen/generated/shared/c++/HybridMarkdownParserSpec.cpp
37
+ ../nitrogen/generated/shared/c++/HybridMarkdownSessionSpec.cpp
37
38
  # Android-specific Nitrogen C++ sources
38
-
39
+ ../nitrogen/generated/android/c++/JHybridMarkdownSessionSpec.cpp
39
40
  )
40
41
 
41
42
  # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
@@ -2,7 +2,7 @@
2
2
  /// NitroMarkdown+autolinking.gradle
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  /// This is a Gradle file that adds all files generated by Nitrogen
@@ -2,7 +2,7 @@
2
2
  /// NitroMarkdownOnLoad.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #ifndef BUILDING_NITROMARKDOWN_WITH_GENERATED_CMAKE_PROJECT
@@ -15,18 +15,22 @@
15
15
  #include <fbjni/fbjni.h>
16
16
  #include <NitroModules/HybridObjectRegistry.hpp>
17
17
 
18
+ #include "JHybridMarkdownSessionSpec.hpp"
19
+ #include "JFunc_void.hpp"
18
20
  #include "HybridMarkdownParser.hpp"
21
+ #include <NitroModules/DefaultConstructableObject.hpp>
19
22
 
20
- namespace margelo::nitro::NitroMarkdown {
23
+ namespace margelo::nitro::Markdown {
21
24
 
22
25
  int initialize(JavaVM* vm) {
23
26
  using namespace margelo::nitro;
24
- using namespace margelo::nitro::NitroMarkdown;
27
+ using namespace margelo::nitro::Markdown;
25
28
  using namespace facebook;
26
29
 
27
30
  return facebook::jni::initialize(vm, [] {
28
31
  // Register native JNI methods
29
-
32
+ margelo::nitro::Markdown::JHybridMarkdownSessionSpec::registerNatives();
33
+ margelo::nitro::Markdown::JFunc_void_cxx::registerNatives();
30
34
 
31
35
  // Register Nitro Hybrid Objects
32
36
  HybridObjectRegistry::registerHybridObjectConstructor(
@@ -38,7 +42,15 @@ int initialize(JavaVM* vm) {
38
42
  return std::make_shared<HybridMarkdownParser>();
39
43
  }
40
44
  );
45
+ HybridObjectRegistry::registerHybridObjectConstructor(
46
+ "MarkdownSession",
47
+ []() -> std::shared_ptr<HybridObject> {
48
+ static DefaultConstructableObject<JHybridMarkdownSessionSpec::javaobject> object("com/margelo/nitro/com/nitromarkdown/HybridMarkdownSession");
49
+ auto instance = object.create();
50
+ return instance->cthis()->shared();
51
+ }
52
+ );
41
53
  });
42
54
  }
43
55
 
44
- } // namespace margelo::nitro::NitroMarkdown
56
+ } // namespace margelo::nitro::Markdown
@@ -2,13 +2,13 @@
2
2
  /// NitroMarkdownOnLoad.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include <jni.h>
9
9
  #include <NitroModules/NitroDefines.hpp>
10
10
 
11
- namespace margelo::nitro::NitroMarkdown {
11
+ namespace margelo::nitro::Markdown {
12
12
 
13
13
  /**
14
14
  * Initializes the native (C++) part of NitroMarkdown, and autolinks all Hybrid Objects.
@@ -16,10 +16,10 @@ namespace margelo::nitro::NitroMarkdown {
16
16
  * Example:
17
17
  * ```cpp (cpp-adapter.cpp)
18
18
  * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
- * return margelo::nitro::NitroMarkdown::initialize(vm);
19
+ * return margelo::nitro::Markdown::initialize(vm);
20
20
  * }
21
21
  * ```
22
22
  */
23
23
  int initialize(JavaVM* vm);
24
24
 
25
- } // namespace margelo::nitro::NitroMarkdown
25
+ } // namespace margelo::nitro::Markdown