react-native-enriched-markdown-scaffold 1.0.2-scaffold.9 → 1.2.0-scaffold.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 (346) hide show
  1. package/ReactNativeEnrichedMarkdown.podspec +31 -10
  2. package/android/build.gradle +49 -12
  3. package/android/consumer-rules.pro +3 -0
  4. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerDelegate.java +18 -0
  5. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerInterface.java +6 -0
  6. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerDelegate.java +3 -0
  7. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerInterface.java +1 -0
  8. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerDelegate.java +18 -0
  9. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerInterface.java +6 -0
  10. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.cpp +62 -0
  11. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.h +44 -0
  12. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.cpp +67 -2
  13. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +929 -178
  14. package/android/src/main/baseline-prof.txt +21 -22
  15. package/android/src/main/cpp/jni-adapter.cpp +17 -5
  16. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdown.kt +729 -768
  17. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownInternalText.kt +1 -1
  18. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownManager.kt +72 -3
  19. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt +222 -8
  20. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextManager.kt +65 -1
  21. package/android/src/main/java/com/swmansion/enriched/markdown/MeasurementStore.kt +191 -26
  22. package/android/src/main/java/com/swmansion/enriched/markdown/accessibility/AccessibleMarkdownTextView.kt +10 -0
  23. package/android/src/main/java/com/swmansion/enriched/markdown/accessibility/MarkdownAccessibilityHelper.kt +54 -6
  24. package/android/src/main/java/com/swmansion/enriched/markdown/events/CodeBlockPressEvent.kt +24 -0
  25. package/android/src/main/java/com/swmansion/enriched/markdown/events/ImagePressEvent.kt +25 -0
  26. package/android/src/main/java/com/swmansion/enriched/markdown/events/LatexErrorEvent.kt +29 -0
  27. package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputManager.kt +21 -0
  28. package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputView.kt +101 -9
  29. package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/EditPipeline.kt +48 -0
  30. package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/InputConnectionWrapper.kt +7 -0
  31. package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/MarkdownShortcutMatcher.kt +64 -0
  32. package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/InputRemend.kt +44 -6
  33. package/android/src/main/java/com/swmansion/enriched/markdown/input/layout/InputEventEmitter.kt +9 -8
  34. package/android/src/main/java/com/swmansion/enriched/markdown/math/LatexErrorReporter.kt +9 -0
  35. package/android/src/main/java/com/swmansion/enriched/markdown/parser/MarkdownASTNode.kt +6 -0
  36. package/android/src/main/java/com/swmansion/enriched/markdown/parser/Parser.kt +5 -1
  37. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlankLineRenderer.kt +38 -0
  38. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockStyleContext.kt +2 -2
  39. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockquoteRenderer.kt +3 -2
  40. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockquoteTextRenderer.kt +55 -0
  41. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/CodeBlockRenderer.kt +8 -1
  42. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/HighlightRenderer.kt +10 -1
  43. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/NodeRenderer.kt +31 -3
  44. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ParagraphRenderer.kt +17 -2
  45. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/Renderer.kt +40 -21
  46. package/android/src/main/java/com/swmansion/enriched/markdown/segments/AdmonitionIcons.kt +62 -0
  47. package/android/src/main/java/com/swmansion/enriched/markdown/{views → segments}/BlockSegmentView.kt +1 -1
  48. package/android/src/main/java/com/swmansion/enriched/markdown/segments/BlockquoteContainerView.kt +401 -0
  49. package/android/src/main/java/com/swmansion/enriched/markdown/{views → segments}/CodeBlockContainerView.kt +55 -16
  50. package/android/src/main/java/com/swmansion/enriched/markdown/segments/ContainerNodeView.kt +164 -0
  51. package/android/src/main/java/com/swmansion/enriched/markdown/{utils/common → segments}/MarkdownSegment.kt +21 -1
  52. package/android/src/main/java/com/swmansion/enriched/markdown/segments/RenderedSegment.kt +137 -0
  53. package/android/src/main/java/com/swmansion/enriched/markdown/segments/SegmentHeightMeasurer.kt +139 -0
  54. package/android/src/main/java/com/swmansion/enriched/markdown/{utils/common → segments}/SegmentReconciler.kt +1 -1
  55. package/android/src/main/java/com/swmansion/enriched/markdown/{utils/common → segments}/SegmentSignature.kt +3 -1
  56. package/android/src/main/java/com/swmansion/enriched/markdown/segments/SegmentViewCreators.kt +262 -0
  57. package/android/src/main/java/com/swmansion/enriched/markdown/segments/SegmentViewFactory.kt +29 -0
  58. package/android/src/main/java/com/swmansion/enriched/markdown/{views → segments}/TableContainerView.kt +100 -36
  59. package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBackgroundSpan.kt +18 -17
  60. package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBlockSpan.kt +3 -0
  61. package/android/src/main/java/com/swmansion/enriched/markdown/spans/HighlightSpan.kt +60 -6
  62. package/android/src/main/java/com/swmansion/enriched/markdown/spans/ImageSpan.kt +15 -5
  63. package/android/src/main/java/com/swmansion/enriched/markdown/spans/InlineBackgroundGeometry.kt +42 -0
  64. package/android/src/main/java/com/swmansion/enriched/markdown/spans/InlineChipPainter.kt +4 -27
  65. package/android/src/main/java/com/swmansion/enriched/markdown/spans/LineHeightSpan.kt +10 -0
  66. package/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkSpan.kt +1 -1
  67. package/android/src/main/java/com/swmansion/enriched/markdown/spoiler/SpoilerDrawUtils.kt +11 -0
  68. package/android/src/main/java/com/swmansion/enriched/markdown/styles/BlockquoteStyle.kt +27 -0
  69. package/android/src/main/java/com/swmansion/enriched/markdown/styles/LinkVariantEntry.kt +2 -0
  70. package/android/src/main/java/com/swmansion/enriched/markdown/styles/StyleConfig.kt +10 -0
  71. package/android/src/main/java/com/swmansion/enriched/markdown/styles/VideoStyle.kt +31 -0
  72. package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/BorderStyleUtils.kt +86 -0
  73. package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/EllipsizeUtils.kt +27 -0
  74. package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/EnrichedMarkdownAncestorUtils.kt +10 -0
  75. package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/FeatureFlags.kt +1 -0
  76. package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/MarkdownViewManagerUtils.kt +36 -0
  77. package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/ReadableMapExtensions.kt +5 -0
  78. package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/serialization/MarkdownASTSerializer.kt +227 -0
  79. package/android/src/main/java/com/swmansion/enriched/markdown/utils/input/PasteTextUtils.kt +34 -2
  80. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/conversion/HTMLGenerator.kt +50 -28
  81. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/conversion/MarkdownExtractor.kt +16 -21
  82. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/extensions/SpannableExtensions.kt +4 -3
  83. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/span/BlockSpacing.kt +3 -2
  84. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/span/SpanFlags.kt +13 -0
  85. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/CodeBlockPressHost.kt +15 -0
  86. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/ImagePressHost.kt +19 -0
  87. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/LinkEvents.kt +11 -0
  88. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/LinkLongPressMovementMethod.kt +87 -2
  89. package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/TextViewSetup.kt +79 -0
  90. package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/conversions.h +2 -0
  91. package/android/src/math/java/com/swmansion/enriched/markdown/renderer/MathInlineRenderer.kt +9 -3
  92. package/android/src/math/java/com/swmansion/enriched/markdown/{views → segments}/MathContainerView.kt +86 -29
  93. package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathInlineSpan.kt +33 -7
  94. package/android/src/video/java/com/swmansion/enriched/markdown/segments/VideoContainerView.kt +115 -0
  95. package/cpp/md4c/md4c.c +343 -236
  96. package/cpp/md4c/md4c.h +28 -11
  97. package/cpp/parser/MD4CParser.cpp +266 -4
  98. package/cpp/parser/MD4CParser.hpp +6 -2
  99. package/cpp/parser/MarkdownASTNode.hpp +4 -1
  100. package/cpp/wasm/ASTSerializer.cpp +6 -0
  101. package/cpp/wasm/md4c_wasm.cpp +5 -1
  102. package/docs/API_REFERENCE.md +199 -12
  103. package/docs/BREAKING_CHANGES.md +75 -0
  104. package/docs/CODE_HIGHLIGHT.md +4 -0
  105. package/docs/COPY_OPTIONS.md +52 -9
  106. package/docs/ELEMENTS_STRUCTURE.md +48 -1
  107. package/docs/INPUT.md +60 -3
  108. package/docs/LATEX_MATH.md +30 -0
  109. package/docs/MACOS.md +1 -1
  110. package/docs/MENTIONS.md +2 -2
  111. package/docs/STYLES.md +27 -0
  112. package/docs/TEXT.md +8 -0
  113. package/docs/WEB.md +44 -10
  114. package/ios/EnrichedMarkdown.mm +285 -43
  115. package/ios/EnrichedMarkdownText.mm +185 -23
  116. package/ios/attachments/ENRMImageAttachment.h +17 -2
  117. package/ios/attachments/ENRMImageAttachment.m +26 -28
  118. package/ios/attachments/ENRMMathInlineAttachment+macOS.m +10 -2
  119. package/ios/attachments/ENRMMathInlineAttachment.h +3 -1
  120. package/ios/attachments/ENRMMathInlineAttachment.m +17 -1
  121. package/ios/attachments/ENRMMathInlineAttachmentShared.h +3 -0
  122. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.cpp +62 -0
  123. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.h +44 -0
  124. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.cpp +67 -2
  125. package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.h +929 -178
  126. package/ios/input/ENRMInputFormatter.mm +68 -12
  127. package/ios/input/ENRMInputFormatterStyle.mm +9 -2
  128. package/ios/input/ENRMInputParser.mm +18 -0
  129. package/ios/input/ENRMInputRemend.mm +40 -3
  130. package/ios/input/ENRMMarkdownShortcutMatcher.h +39 -0
  131. package/ios/input/ENRMMarkdownShortcutMatcher.mm +66 -0
  132. package/ios/input/EnrichedMarkdownTextInput.mm +129 -1
  133. package/ios/internals/ENRMViewFreeMeasurement.h +45 -6
  134. package/ios/internals/MeasurementCache.h +20 -4
  135. package/ios/internals/ShadowMeasurementUtils.h +2 -0
  136. package/ios/math/ENRMLatexErrorCoordinator.h +27 -0
  137. package/ios/math/ENRMLatexErrorCoordinator.mm +75 -0
  138. package/ios/math/ENRMLatexErrorReporting.h +13 -0
  139. package/ios/math/ENRMRaTeXBridge.swift +46 -3
  140. package/ios/parser/ENRMMarkdownParser.h +3 -0
  141. package/ios/parser/ENRMMarkdownParser.mm +11 -2
  142. package/ios/parser/MarkdownASTNode.h +8 -1
  143. package/ios/parser/MarkdownASTNode.m +20 -0
  144. package/ios/parser/MarkdownParserBridge.mm +13 -2
  145. package/ios/renderer/AttributedRenderer.h +13 -1
  146. package/ios/renderer/AttributedRenderer.m +24 -13
  147. package/ios/renderer/BaselineShiftTextAttributes.h +4 -0
  148. package/ios/renderer/BaselineShiftTextAttributes.m +4 -0
  149. package/ios/renderer/BlankLineRenderer.h +4 -0
  150. package/ios/renderer/BlankLineRenderer.m +51 -0
  151. package/ios/renderer/BlockquoteRenderer.m +1 -0
  152. package/ios/renderer/CodeBlockRenderer.m +8 -0
  153. package/ios/renderer/CodeRenderer.m +5 -2
  154. package/ios/renderer/ENRMBlockquoteTextRenderer.h +25 -0
  155. package/ios/renderer/ENRMBlockquoteTextRenderer.m +48 -0
  156. package/ios/renderer/ENRMImageRenderer.m +1 -1
  157. package/ios/renderer/ENRMMathInlineRenderer.m +9 -1
  158. package/ios/renderer/HeadingRenderer.m +1 -0
  159. package/ios/renderer/HighlightRenderer.m +6 -0
  160. package/ios/renderer/LinkRenderer.m +1 -1
  161. package/ios/renderer/ListItemRenderer.m +51 -2
  162. package/ios/renderer/ParagraphRenderer.m +10 -3
  163. package/ios/renderer/RenderContext.h +16 -0
  164. package/ios/renderer/RenderContext.m +16 -0
  165. package/ios/renderer/RendererFactory.m +6 -0
  166. package/ios/renderer/SubscriptRenderer.m +1 -0
  167. package/ios/renderer/SuperscriptRenderer.m +1 -0
  168. package/ios/segments/ENRMAdmonitionIcons.h +31 -0
  169. package/ios/segments/ENRMAdmonitionIcons.m +93 -0
  170. package/ios/segments/ENRMBlockquoteContainerView.h +90 -0
  171. package/ios/segments/ENRMBlockquoteContainerView.mm +551 -0
  172. package/ios/{views → segments}/ENRMCodeBlockContainerView.h +9 -4
  173. package/ios/{views → segments}/ENRMCodeBlockContainerView.m +147 -36
  174. package/ios/segments/ENRMContainerNodeView.h +52 -0
  175. package/ios/segments/ENRMContainerNodeView.mm +201 -0
  176. package/ios/segments/ENRMDynamicBlockProps.h +32 -0
  177. package/ios/segments/ENRMDynamicBlockProps.m +15 -0
  178. package/ios/{views → segments}/ENRMMathContainerView.h +13 -5
  179. package/ios/{views → segments}/ENRMMathContainerView.m +60 -9
  180. package/ios/segments/ENRMSVGPath.h +21 -0
  181. package/ios/segments/ENRMSVGPath.m +409 -0
  182. package/ios/segments/ENRMSegmentHeightMeasurer.h +33 -0
  183. package/ios/segments/ENRMSegmentHeightMeasurer.mm +94 -0
  184. package/ios/segments/ENRMVideoContainerView.h +40 -0
  185. package/ios/segments/ENRMVideoContainerView.m +421 -0
  186. package/ios/{utils → segments}/RenderedMarkdownSegment.h +19 -2
  187. package/ios/{utils → segments}/RenderedMarkdownSegment.m +42 -1
  188. package/ios/segments/SegmentRenderer.h +26 -0
  189. package/ios/{utils → segments}/SegmentRenderer.m +46 -9
  190. package/ios/{views → segments}/TableContainerView.h +5 -4
  191. package/ios/{views → segments}/TableContainerView.m +96 -12
  192. package/ios/styles/StyleConfig.h +17 -0
  193. package/ios/styles/StyleConfig.mm +90 -0
  194. package/ios/utils/ENRMCodeBlockContent.mm +13 -0
  195. package/ios/utils/ENRMFeatureFlags.h +6 -0
  196. package/ios/utils/ENRMTextRenderer.h +8 -0
  197. package/ios/utils/ENRMTextRenderer.m +26 -10
  198. package/ios/utils/ENRMUIKit.h +1 -0
  199. package/ios/utils/FontUtils.h +2 -1
  200. package/ios/utils/FontUtils.m +22 -6
  201. package/ios/utils/LinkTapUtils.h +17 -2
  202. package/ios/utils/LinkTapUtils.m +44 -2
  203. package/ios/utils/ListMarkerDrawer.m +25 -1
  204. package/ios/utils/MarkdownASTSerializer.h +7 -0
  205. package/ios/utils/MarkdownASTSerializer.m +243 -0
  206. package/ios/utils/MarkdownAccessibilityElementBuilder.m +9 -67
  207. package/ios/utils/MarkdownExtractor.m +6 -3
  208. package/ios/utils/ParagraphStyleUtils.h +25 -1
  209. package/ios/utils/ParagraphStyleUtils.m +51 -7
  210. package/ios/utils/StylePropsUtils.h +60 -1
  211. package/ios/utils/TextViewLayoutManager.mm +57 -0
  212. package/lib/module/EnrichedMarkdownNativeComponent.ts +110 -4
  213. package/lib/module/EnrichedMarkdownTextInput.js +60 -2
  214. package/lib/module/EnrichedMarkdownTextInput.js.map +1 -1
  215. package/lib/module/EnrichedMarkdownTextInputNativeComponent.ts +12 -0
  216. package/lib/module/EnrichedMarkdownTextNativeComponent.ts +115 -4
  217. package/lib/module/admonitionDefaults.js +34 -0
  218. package/lib/module/admonitionDefaults.js.map +1 -0
  219. package/lib/module/index.js.map +1 -1
  220. package/lib/module/jest/index.js +84 -4
  221. package/lib/module/jest/index.js.map +1 -1
  222. package/lib/module/native/EnrichedMarkdownText.js +58 -5
  223. package/lib/module/native/EnrichedMarkdownText.js.map +1 -1
  224. package/lib/module/normalizeMarkdownShortcuts.js +31 -0
  225. package/lib/module/normalizeMarkdownShortcuts.js.map +1 -0
  226. package/lib/module/normalizeMarkdownStyle.js +15 -1
  227. package/lib/module/normalizeMarkdownStyle.js.map +1 -1
  228. package/lib/module/normalizeMarkdownStyle.web.js +15 -1
  229. package/lib/module/normalizeMarkdownStyle.web.js.map +1 -1
  230. package/lib/module/styleUtils.js +15 -3
  231. package/lib/module/styleUtils.js.map +1 -1
  232. package/lib/module/utils/textInputState.js +4 -3
  233. package/lib/module/utils/textInputState.js.map +1 -1
  234. package/lib/module/utils/usePressability.js +28 -0
  235. package/lib/module/utils/usePressability.js.map +1 -0
  236. package/lib/module/web/EnrichedMarkdownText.js +19 -6
  237. package/lib/module/web/EnrichedMarkdownText.js.map +1 -1
  238. package/lib/module/web/globalStyles.js +7 -1
  239. package/lib/module/web/globalStyles.js.map +1 -1
  240. package/lib/module/web/nativeProps.js +70 -0
  241. package/lib/module/web/nativeProps.js.map +1 -0
  242. package/lib/module/web/parseMarkdown.js +5 -3
  243. package/lib/module/web/parseMarkdown.js.map +1 -1
  244. package/lib/module/web/renderers/BlockRenderers.js +164 -8
  245. package/lib/module/web/renderers/BlockRenderers.js.map +1 -1
  246. package/lib/module/web/renderers/admonitionIcons.js +34 -0
  247. package/lib/module/web/renderers/admonitionIcons.js.map +1 -0
  248. package/lib/module/web/styles.js +30 -8
  249. package/lib/module/web/styles.js.map +1 -1
  250. package/lib/module/web/wasm/md4c.js +0 -0
  251. package/lib/module/web/wasm/md4c.js.map +1 -1
  252. package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts +103 -3
  253. package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts.map +1 -1
  254. package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts +27 -3
  255. package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts.map +1 -1
  256. package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts +11 -0
  257. package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts.map +1 -1
  258. package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +108 -3
  259. package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts.map +1 -1
  260. package/lib/typescript/src/admonitionDefaults.d.ts +10 -0
  261. package/lib/typescript/src/admonitionDefaults.d.ts.map +1 -0
  262. package/lib/typescript/src/index.d.ts +3 -2
  263. package/lib/typescript/src/index.d.ts.map +1 -1
  264. package/lib/typescript/src/index.web.d.ts +1 -1
  265. package/lib/typescript/src/index.web.d.ts.map +1 -1
  266. package/lib/typescript/src/jest/index.d.ts +2 -2
  267. package/lib/typescript/src/jest/index.d.ts.map +1 -1
  268. package/lib/typescript/src/native/EnrichedMarkdownText.d.ts +3 -3
  269. package/lib/typescript/src/native/EnrichedMarkdownText.d.ts.map +1 -1
  270. package/lib/typescript/src/normalizeMarkdownShortcuts.d.ts +7 -0
  271. package/lib/typescript/src/normalizeMarkdownShortcuts.d.ts.map +1 -0
  272. package/lib/typescript/src/normalizeMarkdownStyle.d.ts.map +1 -1
  273. package/lib/typescript/src/normalizeMarkdownStyle.web.d.ts.map +1 -1
  274. package/lib/typescript/src/styleUtils.d.ts.map +1 -1
  275. package/lib/typescript/src/types/MarkdownStyle.d.ts +59 -1
  276. package/lib/typescript/src/types/MarkdownStyle.d.ts.map +1 -1
  277. package/lib/typescript/src/types/MarkdownStyleInternal.d.ts +21 -0
  278. package/lib/typescript/src/types/MarkdownStyleInternal.d.ts.map +1 -1
  279. package/lib/typescript/src/types/MarkdownTextProps.d.ts +93 -8
  280. package/lib/typescript/src/types/MarkdownTextProps.d.ts.map +1 -1
  281. package/lib/typescript/src/types/MarkdownTextProps.web.d.ts +25 -1
  282. package/lib/typescript/src/types/MarkdownTextProps.web.d.ts.map +1 -1
  283. package/lib/typescript/src/types/events.d.ts +33 -5
  284. package/lib/typescript/src/types/events.d.ts.map +1 -1
  285. package/lib/typescript/src/utils/textInputState.d.ts +5 -3
  286. package/lib/typescript/src/utils/textInputState.d.ts.map +1 -1
  287. package/lib/typescript/src/utils/usePressability.d.ts +24 -0
  288. package/lib/typescript/src/utils/usePressability.d.ts.map +1 -0
  289. package/lib/typescript/src/web/EnrichedMarkdownText.d.ts +1 -1
  290. package/lib/typescript/src/web/EnrichedMarkdownText.d.ts.map +1 -1
  291. package/lib/typescript/src/web/globalStyles.d.ts +1 -0
  292. package/lib/typescript/src/web/globalStyles.d.ts.map +1 -1
  293. package/lib/typescript/src/web/nativeProps.d.ts +34 -0
  294. package/lib/typescript/src/web/nativeProps.d.ts.map +1 -0
  295. package/lib/typescript/src/web/parseMarkdown.d.ts +1 -1
  296. package/lib/typescript/src/web/parseMarkdown.d.ts.map +1 -1
  297. package/lib/typescript/src/web/renderers/BlockRenderers.d.ts.map +1 -1
  298. package/lib/typescript/src/web/renderers/admonitionIcons.d.ts +5 -0
  299. package/lib/typescript/src/web/renderers/admonitionIcons.d.ts.map +1 -0
  300. package/lib/typescript/src/web/styles.d.ts +1 -0
  301. package/lib/typescript/src/web/styles.d.ts.map +1 -1
  302. package/lib/typescript/src/web/types.d.ts +8 -2
  303. package/lib/typescript/src/web/types.d.ts.map +1 -1
  304. package/package.json +1 -1
  305. package/postinstall.mjs +7 -0
  306. package/src/EnrichedMarkdownNativeComponent.ts +110 -4
  307. package/src/EnrichedMarkdownTextInput.tsx +101 -4
  308. package/src/EnrichedMarkdownTextInputNativeComponent.ts +12 -0
  309. package/src/EnrichedMarkdownTextNativeComponent.ts +115 -4
  310. package/src/admonitionDefaults.ts +58 -0
  311. package/src/index.tsx +5 -0
  312. package/src/index.web.tsx +3 -0
  313. package/src/jest/index.tsx +138 -5
  314. package/src/native/EnrichedMarkdownText.tsx +55 -3
  315. package/src/normalizeMarkdownShortcuts.ts +38 -0
  316. package/src/normalizeMarkdownStyle.ts +17 -0
  317. package/src/normalizeMarkdownStyle.web.ts +17 -0
  318. package/src/styleUtils.ts +17 -6
  319. package/src/types/MarkdownStyle.ts +62 -1
  320. package/src/types/MarkdownStyleInternal.ts +24 -0
  321. package/src/types/MarkdownTextProps.ts +95 -7
  322. package/src/types/MarkdownTextProps.web.ts +26 -0
  323. package/src/types/events.ts +36 -5
  324. package/src/utils/textInputState.ts +5 -3
  325. package/src/utils/usePressability.ts +34 -0
  326. package/src/web/EnrichedMarkdownText.tsx +36 -3
  327. package/src/web/globalStyles.ts +10 -0
  328. package/src/web/nativeProps.ts +78 -0
  329. package/src/web/parseMarkdown.ts +10 -2
  330. package/src/web/renderers/BlockRenderers.tsx +175 -6
  331. package/src/web/renderers/admonitionIcons.ts +37 -0
  332. package/src/web/styles.ts +28 -3
  333. package/src/web/types.ts +12 -1
  334. package/src/web/wasm/md4c.js +0 -0
  335. package/vendor-ratex.mjs +86 -17
  336. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/DocumentRenderer.kt +0 -16
  337. package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/RenderedSegment.kt +0 -88
  338. package/ios/utils/SegmentRenderer.h +0 -24
  339. /package/ios/{views → segments}/ENRMTableGridView.h +0 -0
  340. /package/ios/{views → segments}/ENRMTableGridView.m +0 -0
  341. /package/ios/{views → segments}/ENRMTableIOSGridView.h +0 -0
  342. /package/ios/{views → segments}/ENRMTableIOSGridView.m +0 -0
  343. /package/ios/{utils → segments}/SegmentReconciler.h +0 -0
  344. /package/ios/{utils → segments}/SegmentReconciler.m +0 -0
  345. /package/ios/{utils → segments}/SegmentViewRegistry.h +0 -0
  346. /package/ios/{utils → segments}/SegmentViewRegistry.m +0 -0
package/docs/INPUT.md CHANGED
@@ -207,9 +207,60 @@ Three inline constructs are still lossy in this mode, exactly as they are with
207
207
  | Input | Saved as | Why |
208
208
  | --- | --- | --- |
209
209
  | `` gõ `x` vào `` | `gõ x vào` | The editor has no inline code style, so the backticks have nothing to round-trip through |
210
- | `Giá 5\$` | `Giá 5$` | The serializer does not re-escape `\$`, which can leave an unpaired `$` |
210
+ | `Giá 5\$` | `Giá 5$` | The serializer does not re-escape `\$`, which can leave an unpaired `$`. See [Backslash escapes](#backslash-escapes) |
211
211
  | `A & B` | `A B` | HTML entity nodes are dropped. A raw `&` is safe |
212
212
 
213
+ `markdownShortcuts` is forced off while `blockSyntax={false}`: a shortcut would turn a typed
214
+ `# ` or `- ` into structure and drop the marker, which breaks the byte-for-byte guarantee. See
215
+ [Markdown Shortcuts](#markdown-shortcuts).
216
+
217
+ ## Markdown Shortcuts
218
+
219
+ With `markdownShortcuts` enabled, typing a markdown block prefix at the start of a paragraph and following it with a space converts the paragraph into that block and removes the prefix — the convention Notion, Bear, Obsidian and Apple Notes users expect:
220
+
221
+ | Typed | Becomes |
222
+ |---|---|
223
+ | `# ` … `###### ` | Heading 1 … 6 |
224
+ | `- `, `* `, `+ ` | Bullet list item |
225
+ | `1. `, `1) ` (any number) | Numbered list item |
226
+
227
+ ```tsx
228
+ <EnrichedMarkdownTextInput markdownShortcuts />
229
+ ```
230
+
231
+ It is **off by default**: an app that treats `#` or `-` as literal text (tags, channel names, dashes) sees no change unless it opts in. Pass a config object to enable a subset — an omitted key is off:
232
+
233
+ ```tsx
234
+ <EnrichedMarkdownTextInput markdownShortcuts={{ heading: true }} />
235
+ ```
236
+
237
+ Behavior notes:
238
+
239
+ - The shortcut only fires on a **plain paragraph**. Typing `# ` inside an existing heading or list item leaves the text alone.
240
+ - It is a **typing** affordance: it converts only text that was inserted, so pasting `# Title`, typing over a selection or committing an autocorrection never reformats a line. Markdown that is loaded into the input is parsed as markdown already.
241
+ - The conversion goes through the same block pipeline as [`toggleHeading`](#headings) and the [list commands](#lists), so `onChangeState`, serialization and Return-continues-the-list behave exactly as if the block had been toggled from a toolbar.
242
+ - Backspace at the start of a freshly converted **list item** removes the marker again (the existing list Backspace rule). A converted heading is turned off with `toggleHeading` or by deleting the line.
243
+ - Without the shortcut a literal `# Heading` paragraph still serializes as `# Heading`, so it would become a heading the next time the markdown is loaded. Enabling shortcuts makes what the user sees while typing agree with what they get after a reload.
244
+ - Shortcuts are ignored when [`blockSyntax={false}`](#preserving-block-syntax): the JS wrapper always sends them as off in that mode, whatever `markdownShortcuts` says, so the typed prefix stays text and the round trip stays byte for byte.
245
+
246
+ ## Backslash escapes
247
+
248
+ A backslash escape in loaded or pasted markdown (`\*`, `\_`, `\$`, `` \` ``, …) is consumed by the
249
+ parser on **both platforms**: the editor shows the literal character without the backslash, and the
250
+ backslash is not stored anywhere. This applies with `blockSyntax` on and off. (Before upstream v1.1.1,
251
+ iOS kept the backslash in the text while Android already dropped it; #798 aligned iOS with Android.)
252
+
253
+ The serializer does not add escapes back, so escaped markdown does **not** round-trip:
254
+
255
+ | Loaded | Shown in the editor | `onChangeMarkdown` |
256
+ | --- | --- | --- |
257
+ | `\*not italic\*` | `*not italic*` | `*not italic*` (italic the next time it is loaded) |
258
+ | `costs \$5 or \$6` | `costs $5 or $6` | `costs $5 or $6` (inline math the next time it is loaded) |
259
+
260
+ This is a known issue. If a literal `$` or `*` must survive a save and reload, keep it out of a
261
+ position where it pairs with another delimiter, or escape it again in your app before rendering.
262
+
263
+
213
264
  ## Caret Position Tracking
214
265
 
215
266
  `EnrichedMarkdownTextInput` can report the caret's pixel position relative to the input, which is useful when the input is embedded in a scrollable container with `scrollEnabled={false}` and you need to keep the caret visible.
@@ -283,11 +334,13 @@ Because nothing is written until you resolve, an async decision is safe: the sel
283
334
  | | Behavior |
284
335
  | --- | --- |
285
336
  | **iOS** | Context menu and hardware ⌘V. `markdown` is set when the copy source was an `EnrichedMarkdownTextInput`. |
286
- | **Android** | Context menu, hardware Ctrl+V and `KEYCODE_PASTE`. `markdown` is always `''`, and `resolvePaste` inserts `text` verbatim — so an intercepted copy-then-paste inside the app lands as plain text, even though the un-intercepted paste restores the formatting. |
337
+ | **Android** | Context menu, hardware Ctrl+V, `KEYCODE_PASTE`, and a keyboard clipboard chip (Gboard, Samsung Keyboard) — see below. `markdown` is always `''`, and `resolvePaste` inserts `text` verbatim — so an intercepted copy-then-paste inside the app lands as plain text, even though the un-intercepted paste restores the formatting. |
287
338
  | **macOS** | `interceptPaste` is ignored, `onPaste` never fires, and pastes insert inline as usual. |
288
339
 
289
340
  Only clipboard content is intercepted. Drag-and-drop, autofill and IME content insertion bypass `onPaste` on both platforms and insert normally — on Android they are filtered out explicitly, so an autofill never arrives looking like a paste.
290
341
 
342
+ On Android a keyboard clipboard chip does not paste through the menu: the keyboard types the text in through the input connection. The input reports it as a paste when the committed text is exactly the current clipboard text and is at least 16 characters long or spans more than one line. Shorter single-line chip pastes, entries from the keyboard's clipboard history other than the current clip, and text the keyboard changes on the way insert inline without `onPaste`.
343
+
291
344
  ## Style Detection
292
345
 
293
346
  All of the above styles can be detected with the use of [onChangeState](API_REFERENCE.md#onchangestate) callback payload.
@@ -298,7 +351,7 @@ You can find some examples in the [usage section](#usage) or in the example app.
298
351
 
299
352
  `EnrichedMarkdownTextInput` emits a few more events that may be of use:
300
353
 
301
- - [onFocus](API_REFERENCE.md#onfocus-1) - emits whenever input focuses.
354
+ - [onFocus](API_REFERENCE.md#onfocus) - emits whenever input focuses.
302
355
  - [onBlur](API_REFERENCE.md#onblur) - emits whenever input blurs.
303
356
  - [onChangeText](API_REFERENCE.md#onchangetext) - returns the input's plain text (without Markdown syntax) anytime it changes.
304
357
  - [onChangeMarkdown](API_REFERENCE.md#onchangemarkdown) - returns the Markdown string parsed from current input text and styles anytime it would change. As parsing the Markdown on each input change can be expensive, not assigning the event's callback will skip the serialization for better performance.
@@ -376,3 +429,7 @@ Available style properties:
376
429
  (`$...$`) at bold weight. See [LATEX_MATH.md](./LATEX_MATH.md#bold-formulas).
377
430
  - `math.fontWeight` — same for block formula chips (`$$...$$`); inherits from
378
431
  `inlineMath.fontWeight` when unset.
432
+
433
+ > [!NOTE]
434
+ > Block formula chips (`$$...$$`) are typeset in display style on Android and in inline style on
435
+ > iOS. This is a known platform difference; see [LaTeX Math](LATEX_MATH.md#styling-math-in-the-editor).
@@ -80,6 +80,14 @@ the caret, selection and IME step over a formula in one move — and it is why
80
80
  reports the `$...$` source. Offsets in `onChangeSelection`, `onCaretRectChange` and
81
81
  `updateMath` / `removeMath` count a formula as that one character.
82
82
 
83
+ > [!NOTE]
84
+ > **Known difference: `$$...$$` chips in the editor.** On Android a block chip (`$$...$$`) is typeset
85
+ > in display style (large operators, limits above and below `\sum` / `\int`, full-size fractions),
86
+ > matching how `EnrichedMarkdownText` renders block math. On iOS the same chip is typeset in inline
87
+ > (text) style, like a `$...$` chip, so it is shorter and its limits sit beside the operator. The
88
+ > chip's styling keys (`math.*`) and the serialized `$$...$$` source are the same on both platforms;
89
+ > only the typesetting style differs.
90
+
83
91
  ### Bold formulas
84
92
 
85
93
  `math.fontWeight` / `inlineMath.fontWeight` (`'normal'` | `'bold'`, default `'normal'`) typeset a
@@ -128,6 +136,28 @@ iOS + Android only; there is no web or macOS chip surface.
128
136
  > [!IMPORTANT]
129
137
  > LaTeX commands use backslashes (e.g. `\frac`, `\alpha`). In regular JS strings and template literals, backslashes are escape characters. Use `String.raw` or double backslashes (`\\frac`) to preserve them. Block math (`$$...$$`) must be on its own line to render as a display element.
130
138
 
139
+ ## Detecting render failures
140
+
141
+ When the engine cannot draw a formula (an unsupported command, a syntax error) it falls back to showing the raw source instead of crashing. The [`onLatexError`](API_REFERENCE.md#onlatexerror) callback lets you observe these failures - for example to report them to an error tracker:
142
+
143
+ ```tsx
144
+ <EnrichedMarkdownText
145
+ markdown={"Inline $\\foo$ and block:\n\n$$\\bar$$"}
146
+ onLatexError={({ source, message, displayMode }) => {
147
+ reportToErrorTracker('latex-render-failed', { source, message, displayMode });
148
+ }}
149
+ />
150
+ ```
151
+
152
+ The whole expression is the unit of failure: the engine either renders an expression in full or rejects it, so `source` is the entire failing inline span or block (no `$`/`$$` delimiters) rather than a single command. `displayMode` is `false` for inline `$...$` and `true` for block `$$...$$`. This is native-only (iOS and Android); on web, unsupported LaTeX falls back to the raw source without a callback.
153
+
154
+ ### De-duplication and re-mounts
155
+
156
+ Each `EnrichedMarkdownText` instance remembers the failures it has already reported (keyed by `displayMode` + `source`) and fires `onLatexError` **at most once per distinct failing expression** for its lifetime. The cache is not cleared when the `markdown` prop changes, so streaming content - where the same expressions are re-parsed on every update - reports each failure only once instead of on every keystroke or token.
157
+
158
+ > [!CAUTION]
159
+ > The de-duplication is per component **instance**, not global. If the component unmounts and remounts (a new instance - e.g. navigating away and back, changing its React `key`, or list virtualization recycling it), the fresh instance has no memory of prior reports and will fire `onLatexError` again for the same expressions. If you forward these to an error tracker, de-duplicate on your side as well (e.g. by `source`) so a remount does not inflate your counts.
160
+
131
161
  ## Web
132
162
 
133
163
  On web the library renders LaTeX via [KaTeX](https://katex.org/) in **MathML output mode**. Browsers render MathML natively — no CSS or font files are required.
package/docs/MACOS.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  `react-native-enriched-markdown-scaffold` supports macOS via [react-native-macos](https://github.com/microsoft/react-native-macos). The native layer shares code with iOS through a platform abstraction header (`ENRMUIKit.h`), with macOS-specific implementations for context menus, text selection, and clipboard handling.
4
4
 
5
- The macOS implementation supports the same rendering elements as iOS — CommonMark, GitHub Flavored Markdown (tables, task lists, strikethrough), images, code blocks, blockquotes, and all other supported elements. `EnrichedMarkdownTextInput` is also available on macOS with full support for inline styles, links, and the native context menu.
5
+ The macOS implementation supports the same rendering elements as iOS — CommonMark, GitHub Flavored Markdown (tables, task lists, strikethrough), images, code blocks, blockquotes, video playback, and all other supported elements. `EnrichedMarkdownTextInput` is also available on macOS with full support for inline styles, links, and the native context menu.
6
6
 
7
7
  ## Known limitations
8
8
 
package/docs/MENTIONS.md CHANGED
@@ -73,10 +73,10 @@ Each key is a regex tested against the link URL. First match wins. Patterns are
73
73
 
74
74
  Inheritance from the base `link` style is split in two groups:
75
75
 
76
- - **Text** (`color`, `underline`): unspecified properties inherit from `link`.
76
+ - **Text** (`color`, `underline`, `fontFamily`): unspecified properties inherit from `link`. `fontFamily` can be overridden per variant and otherwise inherits the base `link` family.
77
77
  - **Box** (`backgroundColor`, `borderRadius`, `paddingHorizontal`, `paddingVertical`, `borderColor`, `borderWidth`): never inherited. A variant that sets none of them renders without a chip, even when `link` is a chip.
78
78
 
79
- `fontFamily` is only configurable on `link` and applies to every variant. See [Link chips](STYLES.md#link-chips) for the box properties.
79
+ See [Link chips](STYLES.md#link-chips) for the box properties.
80
80
 
81
81
  ## Positioning the Suggestion List
82
82
 
package/docs/STYLES.md CHANGED
@@ -165,6 +165,11 @@ The library provides sensible default styles for all Markdown elements out of th
165
165
  borderRadius: 8,
166
166
  marginBottom: 12,
167
167
  },
168
+ video: {
169
+ borderRadius: 12,
170
+ aspectRatio: 16 / 9,
171
+ backgroundColor: '#000000',
172
+ },
168
173
  inlineImage: {
169
174
  size: 20,
170
175
  },
@@ -283,6 +288,14 @@ function App() {
283
288
  | `marginBottom` | `number` | Bottom margin |
284
289
  | `lineHeight` | `number` | Line height |
285
290
 
291
+ > [!NOTE]
292
+ > **`lineHeight` behavior (this fork differs from upstream):** text-only lines are **clamped** to `lineHeight`: a line is laid out at exactly `lineHeight`, even when that is smaller than the font's natural line height. This matches React Native's core `<Text>` and keeps containers that size themselves as `lineHeight × N` lines exact. Only lines that hold self-measuring content use `lineHeight` as a floor and grow to fit it instead of clipping it:
293
+ >
294
+ > - **iOS:** a block (paragraph, heading, list item, blockquote paragraph) that contains inline math or a block image uses `lineHeight` as a floor for all of its lines. Every other block is clamped (`minimumLineHeight = maximumLineHeight = lineHeight`). Fenced code blocks are always clamped.
295
+ > - **Android:** the decision is per line. A line that contains a self-measuring replacement span (inline math, the placeholder used to measure it, or an emoji the system font lacks and EmojiCompat draws) is only expanded, never compressed. Every other line, including lines whose only tall content is large inline `code`, is clamped. Block images are excluded from the span entirely.
296
+ >
297
+ > Upstream v1.1.1 (#740 Android, #832 iOS) changed `lineHeight` to a floor for every line, so a `lineHeight` below the font's natural line height renders at the natural height. The fork keeps the clamp because consumers set `lineHeight` below the natural height of fonts with tall metrics (for example Baloo 2, ~1.6em) and rely on exact line counts. The cost: on text-only lines, glyphs taller than `lineHeight` (large inline `code`, emoji on iOS, or scripts taller than the Latin baseline such as Thai) can overlap the neighbouring line or be clipped at the component's top and bottom edges. If you need the upstream floor, set `lineHeight` at or above the font's natural line height (about `fontSize × 1.2` for system fonts, higher for fonts with tall ascenders).
298
+
286
299
  ### Paragraph and Heading-specific (paragraph, h1-h6)
287
300
 
288
301
  | Property | Type | Description |
@@ -462,6 +475,20 @@ Styles for highlighted text (`==text==`). Requires `md4cFlags={{ highlight: true
462
475
 
463
476
  > Sizing precedence: `aspectRatio` > `maxHeight` > `height`. `resizeMode` applies independently on top. When no new knob is set (`resizeMode`, `maxHeight`, or `aspectRatio`), block images keep the exact legacy fixed-`height` behavior.
464
477
 
478
+ ### Video-specific
479
+
480
+ Styles for block-level videos embedded via the HTML `<video>` tag (e.g. `<video src="url"></video>`). Requires `flavor="github"` and the `enableVideo` opt-in in your app's `package.json`.
481
+
482
+ | Property | Type | Description |
483
+ |----------|------|-------------|
484
+ | `marginTop` | `number` | Top margin |
485
+ | `marginBottom` | `number` | Bottom margin |
486
+ | `borderRadius` | `number` | Corner radius |
487
+ | `aspectRatio` | `number` | Width / height ratio (e.g. `16 / 9`). The video fills the available width and its height is derived from this ratio. Must be positive; defaults to `16 / 9` |
488
+ | `backgroundColor` | `string` | Fill color behind the video element, visible before the video loads or in letterboxing areas |
489
+
490
+ Videos render as native player views — `AVPlayerViewController` on iOS and ExoPlayer (`PlayerView`) on Android. Playback controls are provided by the native player and appear automatically.
491
+
465
492
  ### Inline Image-specific
466
493
 
467
494
  | Property | Type | Description |
package/docs/TEXT.md CHANGED
@@ -97,6 +97,14 @@ See the [API Reference](API_REFERENCE.md#onlinkpress) for detailed examples and
97
97
 
98
98
  Links can be styled as chips (background, radius, padding, border — see [Link chips](STYLES.md#link-chips)) and decorated with your own views via [`renderLinkDecoration`](API_REFERENCE.md#renderlinkdecoration).
99
99
 
100
+ ### Image Handling
101
+
102
+ Rendered images can be made interactive with the `onImagePress` callback, which receives the image `url` and `altText`. Use it to open a lightbox or full-screen viewer. It fires for block and inline images (including those in headings, lists, and blockquotes); an image that is also a link keeps link behavior and fires `onLinkPress` instead. See the [API Reference](API_REFERENCE.md#onimagepress) for details.
103
+
104
+ ### Code Block Handling
105
+
106
+ A fenced code block can be made tappable with the `onCodeBlockPress` callback, which receives the block's `code` and `language`. Use it to build actions like copy-to-clipboard or opening the code in a viewer. A tap anywhere in the block body fires it, while text selection, the header copy button (GitHub flavor), and the long-press menu stay unchanged. Works in both the CommonMark and GitHub flavors, and on web (where the code block is a clickable, keyboard-activatable element). See the [API Reference](API_REFERENCE.md#oncodeblockpress) for details.
107
+
100
108
  ## Supported Markdown Elements
101
109
 
102
110
  `react-native-enriched-markdown-scaffold` supports a comprehensive set of Markdown elements. See [Element Structure](ELEMENTS_STRUCTURE.md) for a detailed overview of all supported elements, their syntax, block vs inline categorization, nesting behavior, and how elements inherit typography from their parent blocks.
package/docs/WEB.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Web Support
2
2
 
3
- `EnrichedMarkdownText` runs on web using [`react-native-web`](https://necolas.github.io/react-native-web/) for the React Native primitives and [md4c](https://github.com/mity/md4c) compiled to WebAssembly for parsing. The WASM binary is bundled in the npm package — no build step is required by consumers.
3
+ `EnrichedMarkdownText` runs on web using plain React and DOM primitives — **no `react-native-web` dependency required**. It works in any React project (Next.js, Vite, Remix, CRA, etc.).
4
+
5
+ Markdown parsing is handled by [md4c](https://github.com/mity/md4c) compiled to WebAssembly. The WASM binary is inlined as base64 inside the bundle (`SINGLE_FILE=1`), so there is no separate `.wasm` file to serve and no build step required by consumers — just import the component and it works.
4
6
 
5
7
  The web renderer uses semantic HTML elements (`<p>`, `<h1>`–`<h6>`, `<blockquote>`, `<ul>`, `<ol>`, `<table>`, etc.) for improved accessibility.
6
8
 
@@ -10,9 +12,12 @@ All core `EnrichedMarkdownText` features are supported on web, including:
10
12
 
11
13
  - Full GFM: tables (with horizontal scroll), task lists (with checkbox interaction), strikethrough, links, images (block and inline), code blocks, LaTeX math (block and inline)
12
14
  - All `markdownStyle` customisation options
13
- - `onLinkPress`, `onLinkLongPress` (mapped to `contextmenu` event), `onTaskListItemPress` callbacks
15
+ - `onLinkPress`, `onLinkLongPress` (mapped to `contextmenu` event), `onImagePress`, `onTaskListItemPress`, `onCodeBlockPress` callbacks
16
+ - `renderLinkDecoration` — overlays a React node on each link, anchored to the link's inline box
17
+ - `onImagePress` — makes rendered images focusable and keyboard-activatable (Enter/Space) with a button role; the browser's right-click menu is preserved
18
+ - `onCodeBlockPress` — makes fenced code blocks clickable and keyboard-activatable (Enter/Space) with a button role, receiving the block's `code` and `language`; clicking while code text is selected does not fire
14
19
  - `enableTaskListItemToggle` — set to `false` to render task list checkboxes read-only (the click is fully inert: no toggle, no `onTaskListItemPress`). The checkbox keeps its normal appearance, marked `readOnly` / `aria-disabled` and pointer-inert rather than `disabled`, matching iOS and Android
15
- - `allowTrailingMargin`, `containerStyle`, `selectable`, `selectionColor`, `md4cFlags` (`underline`, `superscript`, `subscript`, `latexMath`, `highlight`, `hardSoftBreaks`)
20
+ - `allowTrailingMargin`, `containerStyle`, `selectable`, `selectionColor`, `md4cFlags` (`underline`, `superscript`, `subscript`, `latexMath`, `highlight`, `hardSoftBreaks`, `preserveBlankLines`)
16
21
  - RTL support via the `dir` prop (CSS logical properties automatically flip blockquote borders, list indentation, etc.)
17
22
 
18
23
  ### Accessibility
@@ -23,16 +28,23 @@ All core `EnrichedMarkdownText` features are supported on web, including:
23
28
  - Math (KaTeX fallback): `role="math"` and `aria-label` with the expression content
24
29
  - Task list checkboxes: `aria-label` with the task text (e.g. `"Task: Buy groceries"`)
25
30
 
26
- ### Web-only props
31
+ ### Web props
27
32
 
28
33
  | Prop | Description |
29
34
  |---|---|
30
- | `dir` | Sets the text direction on the root container (`'ltr'`, `'rtl'`, or `'auto'`). CSS logical properties in the renderers automatically flip layout for RTL. |
35
+ | `dir` | Web-only. Sets the text direction on the root container (`'ltr'`, `'rtl'`, or `'auto'`). CSS logical properties in the renderers automatically flip layout for RTL. |
36
+ | `testID` | Standard React Native prop; on web it is applied to the root container as `data-testid`. |
31
37
 
32
- The web implementation also exports `WebMarkdownTextProps` which extends `EnrichedMarkdownTextProps` with the web-only props above.
38
+ All of these are part of the exported `EnrichedMarkdownTextProps` type for web.
33
39
 
34
40
  ## Ignored props (native-only)
35
41
 
42
+ These props belong to the iOS/Android API and have no effect on web. Because a
43
+ cross-platform project is usually type-checked against the native prop interface,
44
+ the same JSX compiles for web; these props are stripped before the root element
45
+ is rendered, so they never reach the DOM or trigger React "unknown prop"
46
+ warnings.
47
+
36
48
  | Prop | Reason |
37
49
  |---|---|
38
50
  | `flavor` | The web renderer always uses full GFM capabilities. On native, `flavor` controls whether a single `TextView` (CommonMark) or container-based renderer (GitHub) is used; the DOM has no such constraint. |
@@ -41,10 +53,32 @@ The web implementation also exports `WebMarkdownTextProps` which extends `Enrich
41
53
  | `allowFontScaling` / `maxFontSizeMultiplier` | React Native text scaling props. Browsers handle font scaling natively via OS accessibility settings. |
42
54
  | `streamingAnimation` | Native-only tail fade-in animation. Not yet implemented on web. |
43
55
  | `streamingConfig` | Native-only streaming table configuration. Not yet implemented on web. |
44
- | `contextMenuItems` | Not supported — browsers don't allow extending the native context menu. |
45
- | `selectionMenuConfig` | Not supported — native-only built-in selection menu actions. |
46
- | `contextMenuHidden` | Not supported — browsers own the context menu on selected text. |
47
- | `selectionHandleColor` | Android-only — desktop browsers don't render selection handles. |
56
+ | `numberOfLines` / `ellipsizeMode` | Native text truncation. Not yet implemented on web. |
57
+ | `spoilerOverlay` | Native-only spoiler reveal animation. Not yet implemented on web. |
58
+ | `contextMenuItems` | Not supported - browsers don't allow extending the native context menu. |
59
+ | `selectionMenuConfig` | Not supported - native-only built-in selection menu actions. |
60
+ | `contextMenuHidden` | Not supported - browsers own the context menu on selected text. |
61
+ | `onSelectionChange` | Native-only selection tracking. On web, listen to the DOM `selectionchange` event instead. |
62
+ | `selectionHandleColor` | Android-only - desktop browsers don't render selection handles. |
63
+ | `imageRequestHeaders` | Not supported - browsers don't allow custom headers on `<img>` requests. |
64
+ | `accessibilityLabels` | VoiceOver / TalkBack announcement strings. The web renderer uses semantic HTML and native `aria-*` instead. |
65
+ | `textBreakStrategy` / `lineBreakStrategyIOS` / `writingDirection` | Native line-breaking and paragraph-direction controls. Use `dir` for web text direction. |
66
+ | `enableBlockContextMenu` | Native-only long-press copy popup on block views. |
67
+ | `onCopyPress` / `onLatexError` | Native-only callbacks. |
68
+
69
+ `onCopy` is not in this list because it is also a DOM prop: on web it is not the native `CopyEvent`
70
+ API, it reaches the root `div` as the DOM `copy` clipboard event.
71
+
72
+ `renderLinkDecoration` **is** supported on web (it is not in this list). The callback receives the
73
+ same `LinkDecorationInfo` shape as on native, but `rect` is the link's inline box and `rects` is
74
+ always `[rect]`.
75
+
76
+ The stripping covers this library's own props only. Generic React Native
77
+ `ViewProps` that the native interface inherits - `accessibilityLabel`,
78
+ `onLayout`, `pointerEvents`, `hitSlop`, `nativeID` and friends - are still
79
+ forwarded to the root element and will produce React "unknown prop" warnings on
80
+ web. Use the DOM equivalents (`aria-label`, `id`, CSS) instead. `testID` is the
81
+ exception: it is mapped to `data-testid`.
48
82
 
49
83
  ## Not supported on web
50
84