@saiansh2525/react-native-nitro-markdown 0.3.2

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 (243) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +468 -0
  3. package/android/CMakeLists.txt +40 -0
  4. package/android/build.gradle +92 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +4 -0
  7. package/android/src/main/cpp/cpp-adapter.cpp +7 -0
  8. package/android/src/main/java/com/margelo/nitro/com/nitromarkdown/HybridMarkdownSession.kt +61 -0
  9. package/android/src/main/java/com/nitromarkdown/NitroMarkdownPackage.kt +27 -0
  10. package/cpp/CMakeLists.txt +46 -0
  11. package/cpp/bindings/HybridMarkdownParser.cpp +114 -0
  12. package/cpp/bindings/HybridMarkdownParser.hpp +28 -0
  13. package/cpp/bindings/HybridMarkdownSession.cpp +0 -0
  14. package/cpp/core/MD4CParser.cpp +440 -0
  15. package/cpp/core/MD4CParser.hpp +21 -0
  16. package/cpp/core/MarkdownSessionCore.cpp +0 -0
  17. package/cpp/core/MarkdownTypes.hpp +124 -0
  18. package/cpp/md4c/md4c.c +6610 -0
  19. package/cpp/md4c/md4c.h +410 -0
  20. package/ios/HybridMarkdownSession.swift +64 -0
  21. package/lib/commonjs/Markdown.nitro.js +6 -0
  22. package/lib/commonjs/Markdown.nitro.js.map +1 -0
  23. package/lib/commonjs/MarkdownContext.js +17 -0
  24. package/lib/commonjs/MarkdownContext.js.map +1 -0
  25. package/lib/commonjs/MarkdownSession.js +11 -0
  26. package/lib/commonjs/MarkdownSession.js.map +1 -0
  27. package/lib/commonjs/default-markdown-renderer.js +217 -0
  28. package/lib/commonjs/default-markdown-renderer.js.map +1 -0
  29. package/lib/commonjs/headless.js +98 -0
  30. package/lib/commonjs/headless.js.map +1 -0
  31. package/lib/commonjs/index.js +226 -0
  32. package/lib/commonjs/index.js.map +1 -0
  33. package/lib/commonjs/markdown-stream.js +32 -0
  34. package/lib/commonjs/markdown-stream.js.map +1 -0
  35. package/lib/commonjs/markdown.js +385 -0
  36. package/lib/commonjs/markdown.js.map +1 -0
  37. package/lib/commonjs/package.json +1 -0
  38. package/lib/commonjs/renderers/blockquote.js +36 -0
  39. package/lib/commonjs/renderers/blockquote.js.map +1 -0
  40. package/lib/commonjs/renderers/code.js +99 -0
  41. package/lib/commonjs/renderers/code.js.map +1 -0
  42. package/lib/commonjs/renderers/heading.js +63 -0
  43. package/lib/commonjs/renderers/heading.js.map +1 -0
  44. package/lib/commonjs/renderers/horizontal-rule.js +29 -0
  45. package/lib/commonjs/renderers/horizontal-rule.js.map +1 -0
  46. package/lib/commonjs/renderers/image.js +184 -0
  47. package/lib/commonjs/renderers/image.js.map +1 -0
  48. package/lib/commonjs/renderers/link.js +35 -0
  49. package/lib/commonjs/renderers/link.js.map +1 -0
  50. package/lib/commonjs/renderers/list.js +114 -0
  51. package/lib/commonjs/renderers/list.js.map +1 -0
  52. package/lib/commonjs/renderers/math.js +137 -0
  53. package/lib/commonjs/renderers/math.js.map +1 -0
  54. package/lib/commonjs/renderers/paragraph.js +37 -0
  55. package/lib/commonjs/renderers/paragraph.js.map +1 -0
  56. package/lib/commonjs/renderers/table.js +290 -0
  57. package/lib/commonjs/renderers/table.js.map +1 -0
  58. package/lib/commonjs/specs/MarkdownSession.nitro.js +6 -0
  59. package/lib/commonjs/specs/MarkdownSession.nitro.js.map +1 -0
  60. package/lib/commonjs/theme.js +191 -0
  61. package/lib/commonjs/theme.js.map +1 -0
  62. package/lib/commonjs/use-markdown-stream.js +71 -0
  63. package/lib/commonjs/use-markdown-stream.js.map +1 -0
  64. package/lib/module/Markdown.nitro.js +4 -0
  65. package/lib/module/Markdown.nitro.js.map +1 -0
  66. package/lib/module/MarkdownContext.js +12 -0
  67. package/lib/module/MarkdownContext.js.map +1 -0
  68. package/lib/module/MarkdownSession.js +7 -0
  69. package/lib/module/MarkdownSession.js.map +1 -0
  70. package/lib/module/default-markdown-renderer.js +212 -0
  71. package/lib/module/default-markdown-renderer.js.map +1 -0
  72. package/lib/module/headless.js +90 -0
  73. package/lib/module/headless.js.map +1 -0
  74. package/lib/module/index.js +21 -0
  75. package/lib/module/index.js.map +1 -0
  76. package/lib/module/markdown-stream.js +27 -0
  77. package/lib/module/markdown-stream.js.map +1 -0
  78. package/lib/module/markdown.js +380 -0
  79. package/lib/module/markdown.js.map +1 -0
  80. package/lib/module/package.json +1 -0
  81. package/lib/module/renderers/blockquote.js +31 -0
  82. package/lib/module/renderers/blockquote.js.map +1 -0
  83. package/lib/module/renderers/code.js +93 -0
  84. package/lib/module/renderers/code.js.map +1 -0
  85. package/lib/module/renderers/heading.js +58 -0
  86. package/lib/module/renderers/heading.js.map +1 -0
  87. package/lib/module/renderers/horizontal-rule.js +24 -0
  88. package/lib/module/renderers/horizontal-rule.js.map +1 -0
  89. package/lib/module/renderers/image.js +179 -0
  90. package/lib/module/renderers/image.js.map +1 -0
  91. package/lib/module/renderers/link.js +30 -0
  92. package/lib/module/renderers/link.js.map +1 -0
  93. package/lib/module/renderers/list.js +107 -0
  94. package/lib/module/renderers/list.js.map +1 -0
  95. package/lib/module/renderers/math.js +131 -0
  96. package/lib/module/renderers/math.js.map +1 -0
  97. package/lib/module/renderers/paragraph.js +32 -0
  98. package/lib/module/renderers/paragraph.js.map +1 -0
  99. package/lib/module/renderers/table.js +285 -0
  100. package/lib/module/renderers/table.js.map +1 -0
  101. package/lib/module/specs/MarkdownSession.nitro.js +4 -0
  102. package/lib/module/specs/MarkdownSession.nitro.js.map +1 -0
  103. package/lib/module/theme.js +186 -0
  104. package/lib/module/theme.js.map +1 -0
  105. package/lib/module/use-markdown-stream.js +66 -0
  106. package/lib/module/use-markdown-stream.js.map +1 -0
  107. package/lib/typescript/commonjs/Markdown.nitro.d.ts +13 -0
  108. package/lib/typescript/commonjs/Markdown.nitro.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/MarkdownContext.d.ts +65 -0
  110. package/lib/typescript/commonjs/MarkdownContext.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/MarkdownSession.d.ts +4 -0
  112. package/lib/typescript/commonjs/MarkdownSession.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/default-markdown-renderer.d.ts +10 -0
  114. package/lib/typescript/commonjs/default-markdown-renderer.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/headless.d.ts +61 -0
  116. package/lib/typescript/commonjs/headless.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/index.d.ts +22 -0
  118. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/markdown-stream.d.ts +15 -0
  120. package/lib/typescript/commonjs/markdown-stream.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/markdown.d.ts +60 -0
  122. package/lib/typescript/commonjs/markdown.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/package.json +1 -0
  124. package/lib/typescript/commonjs/renderers/blockquote.d.ts +9 -0
  125. package/lib/typescript/commonjs/renderers/blockquote.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/renderers/code.d.ts +19 -0
  127. package/lib/typescript/commonjs/renderers/code.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/renderers/heading.d.ts +10 -0
  129. package/lib/typescript/commonjs/renderers/heading.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/renderers/horizontal-rule.d.ts +8 -0
  131. package/lib/typescript/commonjs/renderers/horizontal-rule.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/renderers/image.d.ts +13 -0
  133. package/lib/typescript/commonjs/renderers/image.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/renderers/link.d.ts +10 -0
  135. package/lib/typescript/commonjs/renderers/link.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/renderers/list.d.ts +26 -0
  137. package/lib/typescript/commonjs/renderers/list.d.ts.map +1 -0
  138. package/lib/typescript/commonjs/renderers/math.d.ts +14 -0
  139. package/lib/typescript/commonjs/renderers/math.d.ts.map +1 -0
  140. package/lib/typescript/commonjs/renderers/paragraph.d.ts +10 -0
  141. package/lib/typescript/commonjs/renderers/paragraph.d.ts.map +1 -0
  142. package/lib/typescript/commonjs/renderers/table.d.ts +12 -0
  143. package/lib/typescript/commonjs/renderers/table.d.ts.map +1 -0
  144. package/lib/typescript/commonjs/specs/MarkdownSession.nitro.d.ts +12 -0
  145. package/lib/typescript/commonjs/specs/MarkdownSession.nitro.d.ts.map +1 -0
  146. package/lib/typescript/commonjs/theme.d.ts +65 -0
  147. package/lib/typescript/commonjs/theme.d.ts.map +1 -0
  148. package/lib/typescript/commonjs/use-markdown-stream.d.ts +22 -0
  149. package/lib/typescript/commonjs/use-markdown-stream.d.ts.map +1 -0
  150. package/lib/typescript/module/Markdown.nitro.d.ts +13 -0
  151. package/lib/typescript/module/Markdown.nitro.d.ts.map +1 -0
  152. package/lib/typescript/module/MarkdownContext.d.ts +65 -0
  153. package/lib/typescript/module/MarkdownContext.d.ts.map +1 -0
  154. package/lib/typescript/module/MarkdownSession.d.ts +4 -0
  155. package/lib/typescript/module/MarkdownSession.d.ts.map +1 -0
  156. package/lib/typescript/module/default-markdown-renderer.d.ts +10 -0
  157. package/lib/typescript/module/default-markdown-renderer.d.ts.map +1 -0
  158. package/lib/typescript/module/headless.d.ts +61 -0
  159. package/lib/typescript/module/headless.d.ts.map +1 -0
  160. package/lib/typescript/module/index.d.ts +22 -0
  161. package/lib/typescript/module/index.d.ts.map +1 -0
  162. package/lib/typescript/module/markdown-stream.d.ts +15 -0
  163. package/lib/typescript/module/markdown-stream.d.ts.map +1 -0
  164. package/lib/typescript/module/markdown.d.ts +60 -0
  165. package/lib/typescript/module/markdown.d.ts.map +1 -0
  166. package/lib/typescript/module/package.json +1 -0
  167. package/lib/typescript/module/renderers/blockquote.d.ts +9 -0
  168. package/lib/typescript/module/renderers/blockquote.d.ts.map +1 -0
  169. package/lib/typescript/module/renderers/code.d.ts +19 -0
  170. package/lib/typescript/module/renderers/code.d.ts.map +1 -0
  171. package/lib/typescript/module/renderers/heading.d.ts +10 -0
  172. package/lib/typescript/module/renderers/heading.d.ts.map +1 -0
  173. package/lib/typescript/module/renderers/horizontal-rule.d.ts +8 -0
  174. package/lib/typescript/module/renderers/horizontal-rule.d.ts.map +1 -0
  175. package/lib/typescript/module/renderers/image.d.ts +13 -0
  176. package/lib/typescript/module/renderers/image.d.ts.map +1 -0
  177. package/lib/typescript/module/renderers/link.d.ts +10 -0
  178. package/lib/typescript/module/renderers/link.d.ts.map +1 -0
  179. package/lib/typescript/module/renderers/list.d.ts +26 -0
  180. package/lib/typescript/module/renderers/list.d.ts.map +1 -0
  181. package/lib/typescript/module/renderers/math.d.ts +14 -0
  182. package/lib/typescript/module/renderers/math.d.ts.map +1 -0
  183. package/lib/typescript/module/renderers/paragraph.d.ts +10 -0
  184. package/lib/typescript/module/renderers/paragraph.d.ts.map +1 -0
  185. package/lib/typescript/module/renderers/table.d.ts +12 -0
  186. package/lib/typescript/module/renderers/table.d.ts.map +1 -0
  187. package/lib/typescript/module/specs/MarkdownSession.nitro.d.ts +12 -0
  188. package/lib/typescript/module/specs/MarkdownSession.nitro.d.ts.map +1 -0
  189. package/lib/typescript/module/theme.d.ts +65 -0
  190. package/lib/typescript/module/theme.d.ts.map +1 -0
  191. package/lib/typescript/module/use-markdown-stream.d.ts +22 -0
  192. package/lib/typescript/module/use-markdown-stream.d.ts.map +1 -0
  193. package/nitro.json +19 -0
  194. package/nitrogen/generated/.gitattributes +1 -0
  195. package/nitrogen/generated/android/NitroMarkdown+autolinking.cmake +82 -0
  196. package/nitrogen/generated/android/NitroMarkdown+autolinking.gradle +27 -0
  197. package/nitrogen/generated/android/NitroMarkdownOnLoad.cpp +56 -0
  198. package/nitrogen/generated/android/NitroMarkdownOnLoad.hpp +25 -0
  199. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  200. package/nitrogen/generated/android/c++/JHybridMarkdownSessionSpec.cpp +91 -0
  201. package/nitrogen/generated/android/c++/JHybridMarkdownSessionSpec.hpp +70 -0
  202. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/Func_void.kt +80 -0
  203. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/HybridMarkdownSessionSpec.kt +78 -0
  204. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/NitroMarkdownOnLoad.kt +35 -0
  205. package/nitrogen/generated/ios/NitroMarkdown+autolinking.rb +60 -0
  206. package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Bridge.cpp +41 -0
  207. package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Bridge.hpp +93 -0
  208. package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Umbrella.hpp +45 -0
  209. package/nitrogen/generated/ios/NitroMarkdownAutolinking.mm +43 -0
  210. package/nitrogen/generated/ios/NitroMarkdownAutolinking.swift +26 -0
  211. package/nitrogen/generated/ios/c++/HybridMarkdownSessionSpecSwift.cpp +11 -0
  212. package/nitrogen/generated/ios/c++/HybridMarkdownSessionSpecSwift.hpp +108 -0
  213. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  214. package/nitrogen/generated/ios/swift/HybridMarkdownSessionSpec.swift +59 -0
  215. package/nitrogen/generated/ios/swift/HybridMarkdownSessionSpec_cxx.swift +190 -0
  216. package/nitrogen/generated/shared/c++/HybridMarkdownParserSpec.cpp +22 -0
  217. package/nitrogen/generated/shared/c++/HybridMarkdownParserSpec.hpp +65 -0
  218. package/nitrogen/generated/shared/c++/HybridMarkdownSessionSpec.cpp +26 -0
  219. package/nitrogen/generated/shared/c++/HybridMarkdownSessionSpec.hpp +67 -0
  220. package/nitrogen/generated/shared/c++/ParserOptions.hpp +87 -0
  221. package/package.json +134 -0
  222. package/react-native-nitro-markdown.podspec +42 -0
  223. package/src/Markdown.nitro.ts +12 -0
  224. package/src/MarkdownContext.ts +98 -0
  225. package/src/MarkdownSession.ts +8 -0
  226. package/src/default-markdown-renderer.tsx +261 -0
  227. package/src/headless.ts +171 -0
  228. package/src/index.ts +52 -0
  229. package/src/markdown-stream.tsx +32 -0
  230. package/src/markdown.tsx +521 -0
  231. package/src/renderers/blockquote.tsx +30 -0
  232. package/src/renderers/code.tsx +112 -0
  233. package/src/renderers/heading.tsx +66 -0
  234. package/src/renderers/horizontal-rule.tsx +23 -0
  235. package/src/renderers/image.tsx +204 -0
  236. package/src/renderers/link.tsx +33 -0
  237. package/src/renderers/list.tsx +123 -0
  238. package/src/renderers/math.tsx +147 -0
  239. package/src/renderers/paragraph.tsx +45 -0
  240. package/src/renderers/table.tsx +370 -0
  241. package/src/specs/MarkdownSession.nitro.ts +14 -0
  242. package/src/theme.ts +243 -0
  243. package/src/use-markdown-stream.ts +83 -0
@@ -0,0 +1,61 @@
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
+ /**
58
+ * recursively extracts plain text from the AST, normalizing spacing.
59
+ */
60
+ export declare const getFlattenedText: (node: MarkdownNode) => string;
61
+ //# 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;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,YAAY,KAAG,MAkDrD,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,60 @@
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 MarkdownNode } from "./headless";
5
+ import type { ParserOptions } from "./Markdown.nitro";
6
+ import { type CustomRenderers } from "./MarkdownContext";
7
+ export interface MarkdownProps {
8
+ /**
9
+ * The markdown string to parse and render.
10
+ */
11
+ children: string;
12
+ /**
13
+ * Parser options to enable GFM or Math support.
14
+ */
15
+ options?: ParserOptions;
16
+ /**
17
+ * Callback fired when parsing begins.
18
+ */
19
+ onParsingInProgress?: () => void;
20
+ /**
21
+ * Callback fired when parsing completes.
22
+ */
23
+ onParseComplete?: (result: {
24
+ raw: string;
25
+ ast: MarkdownNode;
26
+ text: string;
27
+ }) => void;
28
+ /**
29
+ * Custom renderers for specific markdown node types.
30
+ * Each renderer receives { node, children, Renderer } plus type-specific props.
31
+ */
32
+ renderers?: CustomRenderers;
33
+ /**
34
+ * Custom theme to override default styles.
35
+ */
36
+ theme?: PartialMarkdownTheme;
37
+ /**
38
+ * Style overrides for specific node types.
39
+ * Applied after internal styles, allowing fine-grained customization.
40
+ * @example
41
+ * ```tsx
42
+ * <Markdown styles={{ heading: { color: 'red' }, code_block: { borderRadius: 0 } }}>
43
+ * {content}
44
+ * </Markdown>
45
+ * ```
46
+ */
47
+ styles?: NodeStyleOverrides;
48
+ /**
49
+ * Styling strategy for the component.
50
+ * - "opinionated": Full styling with colors, spacing, and visual effects (default)
51
+ * - "minimal": Bare minimum styling for a clean slate
52
+ */
53
+ stylingStrategy?: StylingStrategy;
54
+ /**
55
+ * Optional style for the container view.
56
+ */
57
+ style?: StyleProp<ViewStyle>;
58
+ }
59
+ export declare const Markdown: FC<MarkdownProps>;
60
+ //# 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;AACtB,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AACpB,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;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE;QACzB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,YAAY,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,IAAI,CAAC;IACX;;;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,CAkEtC,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,EAML,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,CA8JhC,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,CAoB9B,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,CAuCtC,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,CAiC9C,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;AAuDD,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA2B1C,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,CA0BxC,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,CAkCxC,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,eAAgB,SAAQ,YAAY,CAAC;IACpD,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;IACA,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,IAAI,IAAI,CAAC;IACd,UAAU,IAAI,MAAM,CAAC;IAErB,iBAAiB,EAAE,MAAM,CAAC;IAE1B,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 ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "cxxNamespace": ["Markdown"],
3
+ "ios": {
4
+ "iosModuleName": "NitroMarkdown"
5
+ },
6
+ "android": {
7
+ "androidNamespace": ["com", "nitromarkdown"],
8
+ "androidCxxLibName": "NitroMarkdown"
9
+ },
10
+ "autolinking": {
11
+ "MarkdownParser": {
12
+ "cpp": "HybridMarkdownParser"
13
+ },
14
+ "MarkdownSession": {
15
+ "swift": "HybridMarkdownSession",
16
+ "kotlin": "HybridMarkdownSession"
17
+ }
18
+ }
19
+ }
@@ -0,0 +1 @@
1
+ ** linguist-generated=true
@@ -0,0 +1,82 @@
1
+ #
2
+ # NitroMarkdown+autolinking.cmake
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © Marc Rousavy @ Margelo
6
+ #
7
+
8
+ # This is a CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroMarkdown+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_NITROMARKDOWN_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ NitroMarkdown PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/NitroMarkdownOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridMarkdownParserSpec.cpp
37
+ ../nitrogen/generated/shared/c++/HybridMarkdownSessionSpec.cpp
38
+ # Android-specific Nitrogen C++ sources
39
+ ../nitrogen/generated/android/c++/JHybridMarkdownSessionSpec.cpp
40
+ )
41
+
42
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
43
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
44
+ target_compile_definitions(
45
+ NitroMarkdown PRIVATE
46
+ -DFOLLY_NO_CONFIG=1
47
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
48
+ -DFOLLY_USE_LIBCPP=1
49
+ -DFOLLY_CFG_NO_COROUTINES=1
50
+ -DFOLLY_MOBILE=1
51
+ -DFOLLY_HAVE_RECVMMSG=1
52
+ -DFOLLY_HAVE_PTHREAD=1
53
+ # Once we target android-23 above, we can comment
54
+ # the following line. NDK uses GNU style stderror_r() after API 23.
55
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
56
+ )
57
+
58
+ # Add all libraries required by the generated specs
59
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
60
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
61
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
62
+
63
+ # Link all libraries together
64
+ target_link_libraries(
65
+ NitroMarkdown
66
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
67
+ ReactAndroid::jsi # <-- RN: JSI
68
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
69
+ )
70
+
71
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
72
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
73
+ target_link_libraries(
74
+ NitroMarkdown
75
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
76
+ )
77
+ else()
78
+ target_link_libraries(
79
+ NitroMarkdown
80
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
81
+ )
82
+ endif()
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// NitroMarkdown+autolinking.gradle
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /// This is a Gradle file that adds all files generated by Nitrogen
9
+ /// to the current Gradle project.
10
+ ///
11
+ /// To use it, add this to your build.gradle:
12
+ /// ```gradle
13
+ /// apply from: '../nitrogen/generated/android/NitroMarkdown+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 NitroMarkdown is boosted by nitro!")
17
+
18
+ android {
19
+ sourceSets {
20
+ main {
21
+ java.srcDirs += [
22
+ // Nitrogen files
23
+ "${project.projectDir}/../nitrogen/generated/android/kotlin"
24
+ ]
25
+ }
26
+ }
27
+ }