react-native-enriched-markdown-scaffold 0.7.4-scaffold.9 → 1.0.2-scaffold.10
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.
- package/README.md +54 -8
- package/ReactNativeEnrichedMarkdown.podspec +82 -73
- package/android/build.gradle +188 -1
- package/android/consumer-rules.pro +1 -1
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerDelegate.java +27 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownManagerInterface.java +7 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerDelegate.java +24 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextInputManagerInterface.java +8 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerDelegate.java +27 -0
- package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerInterface.java +7 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.cpp +223 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.h +183 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.cpp +65 -0
- package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +1086 -61
- package/android/src/main/baseline-prof.txt +1 -1
- package/android/src/main/cpp/jni-adapter.cpp +74 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdown.kt +351 -13
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownInternalText.kt +62 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownManager.kt +85 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt +160 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextLayoutManager.kt +10 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextManager.kt +76 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/MeasurementStore.kt +126 -10
- package/android/src/main/java/com/swmansion/enriched/markdown/events/CopyPressEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/events/CopyRequestEvent.kt +28 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/events/LinkLayoutEvent.kt +36 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/events/SelectionChangeEvent.kt +43 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputManager.kt +54 -4
- package/android/src/main/java/com/swmansion/enriched/markdown/input/EnrichedMarkdownTextInputView.kt +923 -462
- package/android/src/main/java/com/swmansion/enriched/markdown/input/MarkdownClipboard.kt +42 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/BlockEditCoordinator.kt +196 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/ClipboardCoordinator.kt +73 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/EditContext.kt +19 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/EditPipeline.kt +248 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/EditSession.kt +52 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/InputConnectionWrapper.kt +108 -7
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/LinkCoordinator.kt +69 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/MarkdownTextWatcher.kt +3 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/input/editing/MentionCoordinator.kt +118 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/events/OnChangeStateEvent.kt +26 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/events/OnContextMenuItemPressEvent.kt +26 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/events/OnInputKeyPressEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/events/OnPasteEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/BlockStore.kt +254 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/FormattingStore.kt +80 -87
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/InputFormatter.kt +109 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/InputParser.kt +116 -22
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/MarkdownSerializer.kt +167 -38
- package/android/src/main/java/com/swmansion/enriched/markdown/input/formatting/RangeEditAdjustment.kt +149 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/layout/InputEventEmitter.kt +66 -5
- package/android/src/main/java/com/swmansion/enriched/markdown/input/layout/InputMeasurementStore.kt +4 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/BlockRange.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/BlockType.kt +48 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/FormattingRange.kt +9 -4
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/InputFormatterStyle.kt +39 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/MathAtom.kt +20 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/MathChipStyle.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/MutableRangeBounds.kt +11 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/spans/InputBulletSpan.kt +82 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/spans/InputHeadingSpan.kt +58 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/spans/InputListItemSpacingSpan.kt +37 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/spans/InputOrderedListMarkerSpan.kt +63 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/styles/BlockHandler.kt +54 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/styles/HeadingBlockHandler.kt +27 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/styles/OrderedListBlockHandler.kt +38 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/styles/UnorderedListBlockHandler.kt +37 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/input/toolbar/InputContextMenu.kt +8 -26
- package/android/src/main/java/com/swmansion/enriched/markdown/parser/MarkdownASTNode.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/parser/Parser.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockStyleContext.kt +9 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockquoteRenderer.kt +100 -12
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/CodeBlockRenderer.kt +16 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/HeadingRenderer.kt +4 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/LinkRenderer.kt +37 -7
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListContextManager.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListItemRenderer.kt +74 -18
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListRenderer.kt +43 -4
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/NodeRenderer.kt +9 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/SoftBreakRenderer.kt +16 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/renderer/SpanStyleCache.kt +35 -28
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/BaseListSpan.kt +24 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/BlockquoteSpan.kt +174 -24
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBackgroundSpan.kt +20 -82
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBlockSpan.kt +13 -16
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeSpan.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/EmphasisSpan.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/ImageSpan.kt +182 -46
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/InlineChipPainter.kt +140 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkChipSpans.kt +177 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkSpan.kt +1 -6
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/ListItemSpacingSpan.kt +33 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/ListMarkerAnchorSpan.kt +38 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/OrderedListSpan.kt +2 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/StrongSpan.kt +1 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/TaskListSpan.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/spans/UnorderedListSpan.kt +3 -2
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/BlockquoteStyle.kt +6 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/CodeBlockStyle.kt +26 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/ImageStyle.kt +7 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/InlineMathStyle.kt +16 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/LinkStyle.kt +36 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/LinkVariantEntry.kt +7 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/ListStyle.kt +4 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/MathStyle.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/StyleConfig.kt +13 -4
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/TableStyle.kt +6 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/CodeBlockHighlighter.kt +90 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/CodeBlockNode.kt +57 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/FeatureFlags.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/MarkdownSegment.kt +9 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/MarkdownViewManagerUtils.kt +84 -7
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/ReadableMapExtensions.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/RenderedSegment.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/SegmentSignature.kt +1 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/StreamingMarkdownFilter.kt +83 -5
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/common/serialization/MarkdownASTSerializer.kt +4 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/input/MarkdownStyleParser.kt +74 -44
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/input/PasteTextUtils.kt +52 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/ImageCache.kt +26 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/ImageDownloader.kt +22 -9
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/LocalImageLoader.kt +161 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/conversion/HTMLGenerator.kt +2 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/conversion/MarkdownExtractor.kt +6 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/extensions/TextPaintExtensions.kt +23 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/interaction/CheckboxTouchHelper.kt +7 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/interaction/TaskListTapUtils.kt +41 -21
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/span/BlockSpacing.kt +15 -8
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/HeadlessActionMode.kt +88 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/LinkLayoutCollector.kt +100 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/LinkLongPressMovementMethod.kt +58 -27
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/SelectionActionMode.kt +72 -16
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/view/SelectionChangeReporter.kt +232 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/views/BlockMenuOptions.kt +64 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/views/CodeBlockContainerView.kt +414 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/views/ContextMenuPopup.kt +9 -6
- package/android/src/main/java/com/swmansion/enriched/markdown/views/CopyGlyph.kt +101 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/views/TableContainerView.kt +61 -11
- package/android/src/main/jni/CMakeLists.txt +53 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownContainerShadowNode.cpp +10 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownContainerShadowNode.h +11 -2
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextShadowNode.cpp +10 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextShadowNode.h +12 -2
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextState.cpp +9 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextState.h +24 -0
- package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/conversions.h +16 -0
- package/android/src/math/java/com/swmansion/enriched/markdown/input/math/MathChipControllerImpl.kt +21 -4
- package/android/src/math/java/com/swmansion/enriched/markdown/renderer/MathInlineRenderer.kt +8 -2
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathChipSpan.kt +1 -1
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathInlineSpan.kt +13 -6
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathMeasureHelper.kt +2 -1
- package/android/src/math/java/com/swmansion/enriched/markdown/views/MathContainerView.kt +26 -8
- package/cpp/highlight/CodeBlockHighlighter.cpp +284 -0
- package/cpp/highlight/CodeBlockHighlighter.hpp +66 -0
- package/cpp/highlight/CodeBlockLanguages.cpp +138 -0
- package/cpp/highlight/CodeBlockLanguages.hpp +25 -0
- package/cpp/highlight/HighlightGrammars.hpp +28 -0
- package/cpp/highlight/code_highlight_podspec.rb +211 -0
- package/cpp/highlight/gen-registry.mjs +155 -0
- package/cpp/highlight/grammar-versions.json +159 -0
- package/cpp/highlight/vendor/generated/generated_queries.h +1665 -0
- package/cpp/highlight/vendor/generated/generated_registry.cpp +59 -0
- package/cpp/parser/MD4CParser.cpp +173 -61
- package/cpp/parser/MD4CParser.hpp +1 -0
- package/cpp/parser/MarkdownASTNode.hpp +2 -1
- package/cpp/wasm/ASTSerializer.cpp +2 -0
- package/cpp/wasm/build.sh +1 -0
- package/cpp/wasm/md4c_wasm.cpp +3 -1
- package/docs/ACCESSIBILITY.md +14 -2
- package/docs/API_REFERENCE.md +405 -12
- package/docs/BREAKING_CHANGES.md +129 -0
- package/docs/CODE_HIGHLIGHT.md +133 -0
- package/docs/COPY_OPTIONS.md +61 -3
- package/docs/ELEMENTS_STRUCTURE.md +52 -4
- package/docs/IMAGE_CACHING.md +30 -0
- package/docs/INPUT.md +110 -11
- package/docs/LATEX_MATH.md +87 -45
- package/docs/MACOS.md +1 -1
- package/docs/MARKDOWN_STREAMING.md +27 -1
- package/docs/MENTIONS.md +8 -1
- package/docs/NATIVE_ASSETS.md +127 -0
- package/docs/RTL.md +1 -1
- package/docs/STYLES.md +73 -6
- package/docs/TESTING.md +112 -0
- package/docs/TEXT.md +18 -6
- package/docs/WEB.md +4 -1
- package/ios/EnrichedMarkdown.h +7 -0
- package/ios/EnrichedMarkdown.mm +583 -76
- package/ios/EnrichedMarkdownText.h +7 -0
- package/ios/EnrichedMarkdownText.mm +299 -73
- package/ios/attachments/ENRMImageAttachment.h +9 -0
- package/ios/attachments/ENRMImageAttachment.m +143 -40
- package/ios/attachments/ENRMMathInlineAttachment+macOS.m +2 -1
- package/ios/attachments/ENRMMathInlineAttachment.h +5 -0
- package/ios/attachments/ENRMMathInlineAttachment.m +50 -82
- package/ios/attachments/ENRMMathInlineAttachmentShared.h +2 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.cpp +223 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/EventEmitters.h +183 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.cpp +65 -0
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.h +1086 -61
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/RCTComponentViewHelpers.h +181 -2
- package/ios/input/ENRMAutoLinkDetector.h +2 -1
- package/ios/input/ENRMAutoLinkDetector.mm +79 -41
- package/ios/input/ENRMBlockEditCoordinator.h +71 -0
- package/ios/input/ENRMBlockEditCoordinator.mm +195 -0
- package/ios/input/ENRMBlockRange.h +28 -0
- package/ios/input/ENRMBlockRange.mm +30 -0
- package/ios/input/ENRMBlockStore.h +56 -0
- package/ios/input/ENRMBlockStore.mm +275 -0
- package/ios/input/ENRMClipboardCoordinator.h +45 -0
- package/ios/input/ENRMClipboardCoordinator.mm +120 -0
- package/ios/input/ENRMDetectorPipeline.h +2 -1
- package/ios/input/ENRMEditPipeline.h +76 -0
- package/ios/input/ENRMEditPipeline.mm +228 -0
- package/ios/input/ENRMEditSession.h +36 -0
- package/ios/input/ENRMEditSession.mm +63 -0
- package/ios/input/ENRMFormattingStore.h +17 -0
- package/ios/input/ENRMFormattingStore.mm +95 -105
- package/ios/input/ENRMInputBlockType.h +91 -0
- package/ios/input/ENRMInputBlockType.mm +5 -0
- package/ios/input/ENRMInputDecorationDrawer.h +18 -0
- package/ios/input/ENRMInputEventEmitter.h +56 -0
- package/ios/input/ENRMInputEventEmitter.mm +308 -0
- package/ios/input/ENRMInputFormatter.h +29 -69
- package/ios/input/ENRMInputFormatter.mm +216 -124
- package/ios/input/ENRMInputFormatterStyle.h +99 -0
- package/ios/input/ENRMInputFormatterStyle.mm +188 -0
- package/ios/input/ENRMInputLayoutManager.h +9 -0
- package/ios/input/ENRMInputLayoutManager.mm +30 -0
- package/ios/input/ENRMInputListMarkerDrawer.h +32 -0
- package/ios/input/ENRMInputListMarkerDrawer.mm +426 -0
- package/ios/input/ENRMInputParser.h +5 -6
- package/ios/input/ENRMInputParser.mm +461 -178
- package/ios/input/ENRMInputRemend.mm +2 -2
- package/ios/input/ENRMInputStyleStateBuilder.h +40 -0
- package/ios/input/ENRMInputStyleStateBuilder.mm +60 -0
- package/ios/input/ENRMInputTextView.mm +103 -8
- package/ios/input/ENRMInputTypingAttributesController.h +42 -0
- package/ios/input/ENRMInputTypingAttributesController.mm +203 -0
- package/ios/input/ENRMLinkCoordinator.h +41 -0
- package/ios/input/ENRMLinkCoordinator.mm +89 -0
- package/ios/input/ENRMMarkdownSerializer.h +29 -5
- package/ios/input/ENRMMarkdownSerializer.mm +170 -48
- package/ios/input/ENRMMathAtom.h +26 -0
- package/ios/input/ENRMMathAtom.mm +12 -0
- package/ios/input/ENRMMentionCoordinator.h +45 -0
- package/ios/input/ENRMMentionCoordinator.mm +167 -0
- package/ios/input/ENRMRangeEditAdjustment.h +38 -0
- package/ios/input/ENRMRangeEditAdjustment.mm +91 -0
- package/ios/input/ENRMRangeStoreUtils.h +39 -0
- package/ios/input/EnrichedMarkdownTextInput+ContextMenu.mm +6 -6
- package/ios/input/EnrichedMarkdownTextInput+Internal.h +11 -3
- package/ios/input/EnrichedMarkdownTextInput.h +7 -1
- package/ios/input/EnrichedMarkdownTextInput.mm +1089 -1023
- package/ios/input/InputStylePropsUtils.h +109 -68
- package/ios/input/internals/EnrichedMarkdownTextInputShadowNode.mm +2 -1
- package/ios/input/styles/ENRMBlockHandler.h +46 -0
- package/ios/input/styles/ENRMHeadingBlockHandler.h +15 -0
- package/ios/input/styles/ENRMHeadingBlockHandler.mm +38 -0
- package/ios/input/styles/ENRMOrderedListBlockHandler.h +14 -0
- package/ios/input/styles/ENRMOrderedListBlockHandler.mm +48 -0
- package/ios/input/styles/ENRMUnorderedListBlockHandler.h +15 -0
- package/ios/input/styles/ENRMUnorderedListBlockHandler.mm +51 -0
- package/ios/internals/ENRMViewFreeMeasurement.h +331 -0
- package/ios/internals/EnrichedMarkdownShadowNode.h +1 -3
- package/ios/internals/EnrichedMarkdownShadowNode.mm +16 -20
- package/ios/internals/EnrichedMarkdownTextShadowNode.h +1 -3
- package/ios/internals/EnrichedMarkdownTextShadowNode.mm +15 -20
- package/ios/internals/MeasurementCache.h +41 -9
- package/ios/internals/ShadowMeasurementUtils.h +63 -58
- package/ios/math/ENRMMathChipController.h +74 -0
- package/ios/math/ENRMMathChipController.mm +476 -0
- package/ios/math/ENRMRaTeXBridge.swift +27 -6
- package/ios/parser/ENRMMarkdownParser.h +1 -8
- package/ios/parser/ENRMMarkdownParser.mm +2 -11
- package/ios/parser/MarkdownASTNode.h +2 -1
- package/ios/parser/MarkdownParserBridge.mm +4 -0
- package/ios/renderer/AttributedRenderer.m +20 -2
- package/ios/renderer/BaseRenderer.h +17 -2
- package/ios/renderer/BaseRenderer.m +30 -0
- package/ios/renderer/BlockquoteRenderer.h +1 -1
- package/ios/renderer/BlockquoteRenderer.m +144 -35
- package/ios/renderer/CodeBlockRenderer.h +1 -1
- package/ios/renderer/CodeBlockRenderer.m +27 -23
- package/ios/renderer/CodeRenderer.h +1 -1
- package/ios/renderer/CodeRenderer.m +3 -1
- package/ios/renderer/ENRMImageRenderer.h +1 -1
- package/ios/renderer/ENRMImageRenderer.m +5 -1
- package/ios/renderer/ENRMMathInlineRenderer.h +1 -1
- package/ios/renderer/ENRMMathInlineRenderer.m +6 -1
- package/ios/renderer/ENRMSpoilerRenderer.h +1 -1
- package/ios/renderer/ENRMSpoilerRenderer.m +3 -1
- package/ios/renderer/EmphasisRenderer.h +1 -1
- package/ios/renderer/EmphasisRenderer.m +3 -1
- package/ios/renderer/HeadingRenderer.h +1 -1
- package/ios/renderer/HeadingRenderer.m +13 -6
- package/ios/renderer/HighlightRenderer.h +1 -1
- package/ios/renderer/HighlightRenderer.m +3 -1
- package/ios/renderer/LinkRenderer.h +1 -1
- package/ios/renderer/LinkRenderer.m +50 -16
- package/ios/renderer/ListItemRenderer.h +13 -1
- package/ios/renderer/ListItemRenderer.m +102 -44
- package/ios/renderer/ListRenderer.h +2 -2
- package/ios/renderer/ListRenderer.m +63 -25
- package/ios/renderer/ParagraphRenderer.h +1 -1
- package/ios/renderer/ParagraphRenderer.m +16 -8
- package/ios/renderer/RenderContext.h +10 -0
- package/ios/renderer/RenderContext.m +44 -0
- package/ios/renderer/RendererFactory.m +14 -0
- package/ios/renderer/StrikethroughRenderer.h +1 -1
- package/ios/renderer/StrikethroughRenderer.m +3 -1
- package/ios/renderer/StrongRenderer.h +1 -1
- package/ios/renderer/StrongRenderer.m +3 -1
- package/ios/renderer/SubscriptRenderer.h +1 -1
- package/ios/renderer/SubscriptRenderer.m +3 -1
- package/ios/renderer/SuperscriptRenderer.h +1 -1
- package/ios/renderer/SuperscriptRenderer.m +3 -1
- package/ios/renderer/TextRenderer.h +2 -2
- package/ios/renderer/TextRenderer.m +3 -1
- package/ios/renderer/ThematicBreakRenderer.h +1 -1
- package/ios/renderer/ThematicBreakRenderer.m +3 -1
- package/ios/renderer/UnderlineRenderer.h +1 -1
- package/ios/renderer/UnderlineRenderer.m +3 -1
- package/ios/styles/StyleConfig.h +42 -0
- package/ios/styles/StyleConfig.mm +216 -0
- package/ios/utils/BlockquoteBorder.h +6 -0
- package/ios/utils/BlockquoteBorder.m +249 -52
- package/ios/utils/CodeBackground.m +3 -65
- package/ios/utils/CodeBlockBackground.m +16 -2
- package/ios/utils/ENRMAtomicSize.h +65 -0
- package/ios/utils/ENRMBlockMenu.h +66 -0
- package/ios/utils/ENRMChipDrawing.h +24 -0
- package/ios/utils/ENRMChipDrawing.m +83 -0
- package/ios/utils/ENRMCodeBlockContent.h +37 -0
- package/ios/utils/ENRMCodeBlockContent.mm +79 -0
- package/ios/utils/ENRMCodeBlockHighlighter.h +37 -0
- package/ios/utils/ENRMCodeBlockHighlighter.mm +51 -0
- package/ios/utils/ENRMFeatureFlags.h +7 -0
- package/ios/utils/ENRMImageDownloader.h +11 -1
- package/ios/utils/ENRMImageDownloader.m +60 -16
- package/ios/utils/ENRMLinkChip.h +70 -0
- package/ios/utils/ENRMLinkChip.m +213 -0
- package/ios/utils/ENRMLinkLayout.h +50 -0
- package/ios/utils/ENRMLinkLayout.m +45 -0
- package/ios/utils/ENRMLocalImageLoader.h +31 -0
- package/ios/utils/ENRMLocalImageLoader.m +68 -0
- package/ios/utils/ENRMMathFallback.h +26 -0
- package/ios/utils/ENRMMathFallback.m +18 -0
- package/ios/utils/ENRMSelectionChange.h +120 -0
- package/ios/utils/ENRMSelectionChange.m +282 -0
- package/ios/utils/ENRMTextViewSetup.h +35 -17
- package/ios/utils/EditMenuUtils+macOS.m +4 -1
- package/ios/utils/EditMenuUtils.h +35 -6
- package/ios/utils/EditMenuUtils.m +188 -11
- package/ios/utils/HTMLGenerator.m +2 -1
- package/ios/utils/ImageRequestHeaderUtils.h +35 -0
- package/ios/utils/LastElementUtils.h +1 -0
- package/ios/utils/ListMarkerDrawer.m +29 -42
- package/ios/utils/MarkdownASTSerializer.m +4 -0
- package/ios/utils/MarkdownAccessibilityElementBuilder.m +3 -1
- package/ios/utils/MarkdownExtractor.m +2 -1
- package/ios/utils/ParagraphStyleUtils.h +5 -0
- package/ios/utils/ParagraphStyleUtils.m +77 -17
- package/ios/utils/RTFExportUtils.m +2 -0
- package/ios/utils/RenderedMarkdownSegment.h +13 -1
- package/ios/utils/RenderedMarkdownSegment.m +20 -0
- package/ios/utils/SegmentRenderer.m +17 -4
- package/ios/utils/StreamingMarkdownFilter.h +11 -1
- package/ios/utils/StreamingMarkdownFilter.m +98 -2
- package/ios/utils/StylePropsUtils.h +110 -1
- package/ios/utils/TaskListTapUtils.m +24 -0
- package/ios/utils/TextViewLayoutManager.mm +3 -0
- package/ios/views/ENRMCodeBlockContainerView.h +60 -0
- package/ios/views/ENRMCodeBlockContainerView.m +569 -0
- package/ios/views/ENRMMathContainerView.h +23 -0
- package/ios/views/ENRMMathContainerView.m +87 -20
- package/ios/views/TableContainerView.h +32 -0
- package/ios/views/TableContainerView.m +291 -175
- package/jest.d.ts +1 -0
- package/jest.js +5 -0
- package/lib/module/EnrichedMarkdownNativeComponent.ts +203 -1
- package/lib/module/EnrichedMarkdownTextInput.js +84 -5
- package/lib/module/EnrichedMarkdownTextInput.js.map +1 -1
- package/lib/module/EnrichedMarkdownTextInputNativeComponent.ts +78 -5
- package/lib/module/EnrichedMarkdownTextNativeComponent.ts +204 -1
- package/lib/module/headingDefaults.js +34 -0
- package/lib/module/headingDefaults.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/jest/index.js +205 -0
- package/lib/module/jest/index.js.map +1 -0
- package/lib/module/native/EnrichedMarkdownText.js +199 -15
- package/lib/module/native/EnrichedMarkdownText.js.map +1 -1
- package/lib/module/normalizeMarkdownStyle.js +98 -23
- package/lib/module/normalizeMarkdownStyle.js.map +1 -1
- package/lib/module/normalizeMarkdownStyle.web.js +73 -22
- package/lib/module/normalizeMarkdownStyle.web.js.map +1 -1
- package/lib/module/normalizeMarkdownTextInputStyle.js +62 -15
- package/lib/module/normalizeMarkdownTextInputStyle.js.map +1 -1
- package/lib/module/normalizeMenuItem.js +1 -1
- package/lib/module/utils/textInputState.js +26 -0
- package/lib/module/utils/textInputState.js.map +1 -0
- package/lib/module/web/EnrichedMarkdownText.js +15 -8
- package/lib/module/web/EnrichedMarkdownText.js.map +1 -1
- package/lib/module/web/parseMarkdown.js +4 -3
- package/lib/module/web/parseMarkdown.js.map +1 -1
- package/lib/module/web/renderers/InlineRenderers.js +102 -3
- package/lib/module/web/renderers/InlineRenderers.js.map +1 -1
- package/lib/module/web/renderers/ListRenderers.js +7 -2
- package/lib/module/web/renderers/ListRenderers.js.map +1 -1
- package/lib/module/web/renderers/index.js +7 -4
- package/lib/module/web/renderers/index.js.map +1 -1
- package/lib/module/web/styles.js +101 -6
- package/lib/module/web/styles.js.map +1 -1
- package/lib/module/web/utils.js +14 -0
- package/lib/module/web/utils.js.map +1 -1
- package/lib/module/web/wasm/md4c.js +0 -0
- package/lib/module/web/wasm/md4c.js.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts +185 -2
- package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts +94 -9
- package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts +69 -5
- package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +185 -2
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/headingDefaults.d.ts +9 -0
- package/lib/typescript/src/headingDefaults.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +2 -2
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/lib/typescript/src/jest/index.d.ts +6 -0
- package/lib/typescript/src/jest/index.d.ts.map +1 -0
- package/lib/typescript/src/native/EnrichedMarkdownText.d.ts +5 -5
- package/lib/typescript/src/native/EnrichedMarkdownText.d.ts.map +1 -1
- package/lib/typescript/src/normalizeMarkdownStyle.d.ts.map +1 -1
- package/lib/typescript/src/normalizeMarkdownStyle.web.d.ts.map +1 -1
- package/lib/typescript/src/normalizeMarkdownTextInputStyle.d.ts +19 -5
- package/lib/typescript/src/normalizeMarkdownTextInputStyle.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownStyle.d.ts +122 -5
- package/lib/typescript/src/types/MarkdownStyle.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownStyleInternal.d.ts +39 -0
- package/lib/typescript/src/types/MarkdownStyleInternal.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownTextProps.d.ts +207 -10
- package/lib/typescript/src/types/MarkdownTextProps.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownTextProps.web.d.ts +60 -1
- package/lib/typescript/src/types/MarkdownTextProps.web.d.ts.map +1 -1
- package/lib/typescript/src/types/events.d.ts +85 -0
- package/lib/typescript/src/types/events.d.ts.map +1 -1
- package/lib/typescript/src/utils/textInputState.d.ts +24 -0
- package/lib/typescript/src/utils/textInputState.d.ts.map +1 -0
- package/lib/typescript/src/web/EnrichedMarkdownText.d.ts +1 -1
- package/lib/typescript/src/web/EnrichedMarkdownText.d.ts.map +1 -1
- package/lib/typescript/src/web/parseMarkdown.d.ts +1 -1
- package/lib/typescript/src/web/parseMarkdown.d.ts.map +1 -1
- package/lib/typescript/src/web/renderers/InlineRenderers.d.ts.map +1 -1
- package/lib/typescript/src/web/renderers/ListRenderers.d.ts.map +1 -1
- package/lib/typescript/src/web/renderers/index.d.ts +2 -1
- package/lib/typescript/src/web/renderers/index.d.ts.map +1 -1
- package/lib/typescript/src/web/styles.d.ts +2 -1
- package/lib/typescript/src/web/styles.d.ts.map +1 -1
- package/lib/typescript/src/web/types.d.ts +10 -2
- package/lib/typescript/src/web/types.d.ts.map +1 -1
- package/lib/typescript/src/web/utils.d.ts +4 -0
- package/lib/typescript/src/web/utils.d.ts.map +1 -1
- package/package.json +36 -9
- package/postinstall.mjs +131 -0
- package/ratex-version.json +21 -0
- package/src/EnrichedMarkdownNativeComponent.ts +203 -1
- package/src/EnrichedMarkdownTextInput.tsx +159 -8
- package/src/EnrichedMarkdownTextInputNativeComponent.ts +78 -5
- package/src/EnrichedMarkdownTextNativeComponent.ts +204 -1
- package/src/headingDefaults.ts +21 -0
- package/src/index.tsx +15 -0
- package/src/index.web.tsx +6 -1
- package/src/jest/index.tsx +236 -0
- package/src/native/EnrichedMarkdownText.tsx +260 -11
- package/src/normalizeMarkdownStyle.ts +117 -16
- package/src/normalizeMarkdownStyle.web.ts +76 -15
- package/src/normalizeMarkdownTextInputStyle.ts +110 -35
- package/src/normalizeMenuItem.ts +1 -1
- package/src/types/MarkdownStyle.ts +125 -5
- package/src/types/MarkdownStyleInternal.ts +51 -0
- package/src/types/MarkdownTextProps.ts +215 -10
- package/src/types/MarkdownTextProps.web.ts +62 -1
- package/src/types/events.ts +90 -0
- package/src/utils/textInputState.ts +35 -0
- package/src/web/EnrichedMarkdownText.tsx +26 -5
- package/src/web/parseMarkdown.ts +6 -2
- package/src/web/renderers/InlineRenderers.tsx +116 -3
- package/src/web/renderers/ListRenderers.tsx +14 -2
- package/src/web/renderers/index.tsx +6 -2
- package/src/web/styles.ts +114 -5
- package/src/web/types.ts +10 -1
- package/src/web/utils.ts +9 -0
- package/src/web/wasm/md4c.js +0 -0
- package/vendor-grammars.mjs +511 -0
- package/vendor-ratex.mjs +173 -0
- package/app.plugin.js +0 -2
- package/plugin/build/withAndroidMath.js +0 -19
- package/plugin/build/withIosMath.js +0 -28
- package/plugin/build/withReactNativeEnrichedMarkdown.js +0 -11
- package/plugin/src/withAndroidMath.ts +0 -24
- package/plugin/src/withIosMath.ts +0 -35
- package/plugin/src/withReactNativeEnrichedMarkdown.ts +0 -17
- package/plugin/tsconfig.build.json +0 -16
|
@@ -7,6 +7,10 @@ import type {
|
|
|
7
7
|
} from './types/MarkdownStyleInternal';
|
|
8
8
|
import { isStyleEqual, mergeSubStyle } from './styleUtils';
|
|
9
9
|
import { normalizeLinkVariantEntries } from './linkVariantUtils';
|
|
10
|
+
import {
|
|
11
|
+
DEFAULT_HEADING_FONT_WEIGHT,
|
|
12
|
+
HEADING_DEFAULTS,
|
|
13
|
+
} from './headingDefaults';
|
|
10
14
|
|
|
11
15
|
const SYSTEM_FONT =
|
|
12
16
|
'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
@@ -14,7 +18,6 @@ const MONOSPACE_FONT =
|
|
|
14
18
|
'ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace';
|
|
15
19
|
|
|
16
20
|
const defaultTextColor = '#1F2937';
|
|
17
|
-
const defaultHeadingColor = '#111827';
|
|
18
21
|
|
|
19
22
|
const baseHeader: {
|
|
20
23
|
fontFamily: string;
|
|
@@ -24,7 +27,7 @@ const baseHeader: {
|
|
|
24
27
|
textAlign: BlockTextAlign;
|
|
25
28
|
} = {
|
|
26
29
|
fontFamily: SYSTEM_FONT,
|
|
27
|
-
fontWeight:
|
|
30
|
+
fontWeight: DEFAULT_HEADING_FONT_WEIGHT,
|
|
28
31
|
marginTop: 0,
|
|
29
32
|
marginBottom: 8,
|
|
30
33
|
textAlign: 'auto',
|
|
@@ -43,38 +46,38 @@ const DEFAULT_NORMALIZED_STYLE: MarkdownStyleInternal = Object.freeze({
|
|
|
43
46
|
},
|
|
44
47
|
h1: {
|
|
45
48
|
...baseHeader,
|
|
46
|
-
fontSize:
|
|
47
|
-
color:
|
|
49
|
+
fontSize: HEADING_DEFAULTS.h1.fontSize,
|
|
50
|
+
color: HEADING_DEFAULTS.h1.color,
|
|
48
51
|
lineHeight: 38,
|
|
49
52
|
},
|
|
50
53
|
h2: {
|
|
51
54
|
...baseHeader,
|
|
52
|
-
fontSize:
|
|
53
|
-
color:
|
|
55
|
+
fontSize: HEADING_DEFAULTS.h2.fontSize,
|
|
56
|
+
color: HEADING_DEFAULTS.h2.color,
|
|
54
57
|
lineHeight: 32,
|
|
55
58
|
},
|
|
56
59
|
h3: {
|
|
57
60
|
...baseHeader,
|
|
58
|
-
fontSize:
|
|
59
|
-
color:
|
|
61
|
+
fontSize: HEADING_DEFAULTS.h3.fontSize,
|
|
62
|
+
color: HEADING_DEFAULTS.h3.color,
|
|
60
63
|
lineHeight: 28,
|
|
61
64
|
},
|
|
62
65
|
h4: {
|
|
63
66
|
...baseHeader,
|
|
64
|
-
fontSize:
|
|
65
|
-
color:
|
|
67
|
+
fontSize: HEADING_DEFAULTS.h4.fontSize,
|
|
68
|
+
color: HEADING_DEFAULTS.h4.color,
|
|
66
69
|
lineHeight: 26,
|
|
67
70
|
},
|
|
68
71
|
h5: {
|
|
69
72
|
...baseHeader,
|
|
70
|
-
fontSize:
|
|
71
|
-
color:
|
|
73
|
+
fontSize: HEADING_DEFAULTS.h5.fontSize,
|
|
74
|
+
color: HEADING_DEFAULTS.h5.color,
|
|
72
75
|
lineHeight: 24,
|
|
73
76
|
},
|
|
74
77
|
h6: {
|
|
75
78
|
...baseHeader,
|
|
76
|
-
fontSize:
|
|
77
|
-
color:
|
|
79
|
+
fontSize: HEADING_DEFAULTS.h6.fontSize,
|
|
80
|
+
color: HEADING_DEFAULTS.h6.color,
|
|
78
81
|
lineHeight: 22,
|
|
79
82
|
},
|
|
80
83
|
blockquote: {
|
|
@@ -89,6 +92,8 @@ const DEFAULT_NORMALIZED_STYLE: MarkdownStyleInternal = Object.freeze({
|
|
|
89
92
|
borderWidth: 3,
|
|
90
93
|
gapWidth: 16,
|
|
91
94
|
backgroundColor: '#F9FAFB',
|
|
95
|
+
borderRadius: 0,
|
|
96
|
+
padding: 0,
|
|
92
97
|
},
|
|
93
98
|
list: {
|
|
94
99
|
fontSize: 16,
|
|
@@ -105,6 +110,7 @@ const DEFAULT_NORMALIZED_STYLE: MarkdownStyleInternal = Object.freeze({
|
|
|
105
110
|
markerFontWeight: '500',
|
|
106
111
|
gapWidth: 12,
|
|
107
112
|
marginLeft: 24,
|
|
113
|
+
itemSpacing: 0,
|
|
108
114
|
},
|
|
109
115
|
codeBlock: {
|
|
110
116
|
fontSize: 14,
|
|
@@ -119,12 +125,33 @@ const DEFAULT_NORMALIZED_STYLE: MarkdownStyleInternal = Object.freeze({
|
|
|
119
125
|
borderRadius: 8,
|
|
120
126
|
borderWidth: 1,
|
|
121
127
|
padding: 16,
|
|
128
|
+
syntaxColors: {
|
|
129
|
+
keyword: '#FF7B72',
|
|
130
|
+
operatorColor: '#F3F4F6',
|
|
131
|
+
punctuation: '#F3F4F6',
|
|
132
|
+
string: '#A5D6FF',
|
|
133
|
+
number: '#79C0FF',
|
|
134
|
+
constant: '#79C0FF',
|
|
135
|
+
comment: '#8B949E',
|
|
136
|
+
function: '#D2A8FF',
|
|
137
|
+
type: '#FFA657',
|
|
138
|
+
variable: '#F3F4F6',
|
|
139
|
+
property: '#79C0FF',
|
|
140
|
+
tag: '#7EE787',
|
|
141
|
+
attribute: '#79C0FF',
|
|
142
|
+
embedded: '#F3F4F6',
|
|
143
|
+
},
|
|
122
144
|
},
|
|
123
145
|
link: {
|
|
124
146
|
fontFamily: '',
|
|
125
147
|
color: '#2563EB',
|
|
126
148
|
underline: true,
|
|
127
149
|
backgroundColor: 'transparent',
|
|
150
|
+
borderRadius: 0,
|
|
151
|
+
paddingHorizontal: 0,
|
|
152
|
+
paddingVertical: 0,
|
|
153
|
+
borderColor: 'transparent',
|
|
154
|
+
borderWidth: 0,
|
|
128
155
|
},
|
|
129
156
|
linkVariants: [],
|
|
130
157
|
strong: { fontFamily: '', fontWeight: 'bold', color: undefined },
|
|
@@ -142,7 +169,15 @@ const DEFAULT_NORMALIZED_STYLE: MarkdownStyleInternal = Object.freeze({
|
|
|
142
169
|
backgroundColor: '#FDF2F4',
|
|
143
170
|
borderColor: '#F8D7DA',
|
|
144
171
|
},
|
|
145
|
-
image: {
|
|
172
|
+
image: {
|
|
173
|
+
height: 200,
|
|
174
|
+
maxHeight: 0,
|
|
175
|
+
aspectRatio: 0,
|
|
176
|
+
resizeMode: '' as const,
|
|
177
|
+
borderRadius: 8,
|
|
178
|
+
marginTop: 0,
|
|
179
|
+
marginBottom: 16,
|
|
180
|
+
},
|
|
146
181
|
inlineImage: { size: 20 },
|
|
147
182
|
thematicBreak: {
|
|
148
183
|
color: '#E5E7EB',
|
|
@@ -168,6 +203,8 @@ const DEFAULT_NORMALIZED_STYLE: MarkdownStyleInternal = Object.freeze({
|
|
|
168
203
|
borderRadius: 6,
|
|
169
204
|
cellPaddingHorizontal: 12,
|
|
170
205
|
cellPaddingVertical: 8,
|
|
206
|
+
horizontalOverflow: 0,
|
|
207
|
+
align: '' as const,
|
|
171
208
|
},
|
|
172
209
|
math: {
|
|
173
210
|
fontSize: 20,
|
|
@@ -178,11 +215,13 @@ const DEFAULT_NORMALIZED_STYLE: MarkdownStyleInternal = Object.freeze({
|
|
|
178
215
|
marginBottom: 16,
|
|
179
216
|
textAlign: 'center' as BlockTextAlign,
|
|
180
217
|
fontWeight: 'normal',
|
|
218
|
+
glyphOverflow: 0,
|
|
181
219
|
},
|
|
182
220
|
inlineMath: {
|
|
183
221
|
color: defaultTextColor,
|
|
184
222
|
paddingVertical: 4,
|
|
185
223
|
fontWeight: 'normal',
|
|
224
|
+
glyphOverflow: 0,
|
|
186
225
|
},
|
|
187
226
|
taskList: {
|
|
188
227
|
checkedColor: '#007AFF',
|
|
@@ -257,7 +296,13 @@ export const normalizeMarkdownStyle = (
|
|
|
257
296
|
pattern,
|
|
258
297
|
color: override.color ?? linkBase.color,
|
|
259
298
|
underline: override.underline ?? linkBase.underline,
|
|
299
|
+
// Chip ("box") properties never inherit from the base link style.
|
|
260
300
|
backgroundColor: override.backgroundColor ?? 'transparent',
|
|
301
|
+
borderRadius: override.borderRadius ?? 0,
|
|
302
|
+
paddingHorizontal: override.paddingHorizontal ?? 0,
|
|
303
|
+
paddingVertical: override.paddingVertical ?? 0,
|
|
304
|
+
borderColor: override.borderColor ?? 'transparent',
|
|
305
|
+
borderWidth: override.borderWidth ?? 0,
|
|
261
306
|
};
|
|
262
307
|
}
|
|
263
308
|
);
|
|
@@ -269,6 +314,12 @@ export const normalizeMarkdownStyle = (
|
|
|
269
314
|
);
|
|
270
315
|
}
|
|
271
316
|
|
|
317
|
+
// maxHeight/aspectRatio sizing is resize-mode driven; default to 'cover'.
|
|
318
|
+
const image = result.image as MarkdownStyleInternal['image'];
|
|
319
|
+
if (!image.resizeMode && (image.maxHeight > 0 || image.aspectRatio > 0)) {
|
|
320
|
+
(result.image as { resizeMode: string }).resizeMode = 'cover';
|
|
321
|
+
}
|
|
322
|
+
|
|
272
323
|
if (!style.highlight?.color) {
|
|
273
324
|
const paragraphColor = (
|
|
274
325
|
result.paragraph as MarkdownStyleInternal['paragraph']
|
|
@@ -277,6 +328,16 @@ export const normalizeMarkdownStyle = (
|
|
|
277
328
|
paragraphColor;
|
|
278
329
|
}
|
|
279
330
|
|
|
331
|
+
// The public API exposes `operator`, but the internal token is `operatorColor`
|
|
332
|
+
// (`operator` is reserved in the generated C++ struct). Remap it after merge.
|
|
333
|
+
const syntaxColors = (
|
|
334
|
+
result.codeBlock as { syntaxColors?: Record<string, unknown> }
|
|
335
|
+
).syntaxColors;
|
|
336
|
+
if (syntaxColors && 'operator' in syntaxColors) {
|
|
337
|
+
syntaxColors.operatorColor = syntaxColors.operator;
|
|
338
|
+
delete syntaxColors.operator;
|
|
339
|
+
}
|
|
340
|
+
|
|
280
341
|
const finalResult = Object.freeze(result) as unknown as MarkdownStyleInternal;
|
|
281
342
|
refCache.set(style, finalResult);
|
|
282
343
|
structuralCache.unshift({ style, result: finalResult });
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { processColor, type ColorValue } from 'react-native';
|
|
2
2
|
import type {
|
|
3
|
+
HeadingStyle,
|
|
3
4
|
LinkStyle,
|
|
4
5
|
MarkdownTextInputStyle,
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
InputInlineMathStyle,
|
|
7
|
+
InputMathStyle,
|
|
7
8
|
} from './EnrichedMarkdownTextInput';
|
|
8
9
|
import { normalizeLinkVariantEntries } from './linkVariantUtils';
|
|
9
10
|
import { normalizeColor } from './styleUtils';
|
|
11
|
+
import {
|
|
12
|
+
DEFAULT_HEADING_FONT_WEIGHT,
|
|
13
|
+
HEADING_DEFAULTS,
|
|
14
|
+
type HeadingLevelKey,
|
|
15
|
+
} from './headingDefaults';
|
|
10
16
|
|
|
11
17
|
interface LinkVariantEntryInternal {
|
|
12
18
|
pattern: string;
|
|
@@ -15,7 +21,7 @@ interface LinkVariantEntryInternal {
|
|
|
15
21
|
backgroundColor: ColorValue;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
|
-
interface
|
|
24
|
+
interface InputInlineMathStyleInternal {
|
|
19
25
|
color: ColorValue;
|
|
20
26
|
fontSize: number;
|
|
21
27
|
backgroundColor: ColorValue;
|
|
@@ -29,10 +35,16 @@ interface MathStyleInternal {
|
|
|
29
35
|
fontWeight: string;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
interface
|
|
38
|
+
interface InputMathStyleInternal extends InputInlineMathStyleInternal {
|
|
33
39
|
marginTop: number;
|
|
34
40
|
marginBottom: number;
|
|
35
|
-
|
|
41
|
+
textAlign: 'left' | 'center' | 'right';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface HeadingStyleInternal {
|
|
45
|
+
fontSize: number;
|
|
46
|
+
fontWeight: string;
|
|
47
|
+
color: ColorValue;
|
|
36
48
|
}
|
|
37
49
|
|
|
38
50
|
interface MarkdownTextInputStyleInternal {
|
|
@@ -52,8 +64,17 @@ interface MarkdownTextInputStyleInternal {
|
|
|
52
64
|
color: ColorValue;
|
|
53
65
|
backgroundColor: ColorValue;
|
|
54
66
|
};
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
inlineMath: InputInlineMathStyleInternal;
|
|
68
|
+
math: InputMathStyleInternal;
|
|
69
|
+
h1: HeadingStyleInternal;
|
|
70
|
+
h2: HeadingStyleInternal;
|
|
71
|
+
h3: HeadingStyleInternal;
|
|
72
|
+
h4: HeadingStyleInternal;
|
|
73
|
+
h5: HeadingStyleInternal;
|
|
74
|
+
h6: HeadingStyleInternal;
|
|
75
|
+
list: {
|
|
76
|
+
itemSpacing: number;
|
|
77
|
+
};
|
|
57
78
|
}
|
|
58
79
|
|
|
59
80
|
const DEFAULT_LINK_COLOR = '#2563EB';
|
|
@@ -66,7 +87,7 @@ const DEFAULT_MATH_BORDER_COLOR = 'transparent';
|
|
|
66
87
|
|
|
67
88
|
const TRANSPARENT = processColor('transparent')!;
|
|
68
89
|
|
|
69
|
-
const
|
|
90
|
+
const defaultInlineMathInternal: InputInlineMathStyleInternal = Object.freeze({
|
|
70
91
|
color: processColor(DEFAULT_MATH_COLOR)!,
|
|
71
92
|
fontSize: 16,
|
|
72
93
|
backgroundColor: processColor(DEFAULT_MATH_BG_COLOR)!,
|
|
@@ -80,7 +101,7 @@ const defaultMathInternal: MathStyleInternal = Object.freeze({
|
|
|
80
101
|
fontWeight: 'normal',
|
|
81
102
|
});
|
|
82
103
|
|
|
83
|
-
const
|
|
104
|
+
const defaultBlockMathInternal: InputMathStyleInternal = Object.freeze({
|
|
84
105
|
color: processColor(DEFAULT_MATH_COLOR)!,
|
|
85
106
|
fontSize: 20,
|
|
86
107
|
backgroundColor: processColor(DEFAULT_MATH_BG_COLOR)!,
|
|
@@ -94,9 +115,20 @@ const defaultMathBlockInternal: MathBlockStyleInternal = Object.freeze({
|
|
|
94
115
|
fontWeight: 'normal',
|
|
95
116
|
marginTop: 8,
|
|
96
117
|
marginBottom: 8,
|
|
97
|
-
|
|
118
|
+
textAlign: 'center',
|
|
98
119
|
});
|
|
99
120
|
|
|
121
|
+
// Defaults shared with the read-only renderer via headingDefaults; consumers
|
|
122
|
+
// override per level via markdownStyle h1..h6.
|
|
123
|
+
const defaultHeadingInternal = (key: HeadingLevelKey): HeadingStyleInternal => {
|
|
124
|
+
const d = HEADING_DEFAULTS[key];
|
|
125
|
+
return {
|
|
126
|
+
fontSize: d.fontSize,
|
|
127
|
+
fontWeight: DEFAULT_HEADING_FONT_WEIGHT,
|
|
128
|
+
color: processColor(d.color)!,
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
|
|
100
132
|
const defaultInternal: MarkdownTextInputStyleInternal = Object.freeze({
|
|
101
133
|
strong: {
|
|
102
134
|
color: undefined,
|
|
@@ -114,10 +146,31 @@ const defaultInternal: MarkdownTextInputStyleInternal = Object.freeze({
|
|
|
114
146
|
color: processColor(DEFAULT_SPOILER_COLOR)!,
|
|
115
147
|
backgroundColor: processColor(DEFAULT_SPOILER_BG_COLOR)!,
|
|
116
148
|
},
|
|
117
|
-
|
|
118
|
-
|
|
149
|
+
inlineMath: defaultInlineMathInternal,
|
|
150
|
+
math: defaultBlockMathInternal,
|
|
151
|
+
h1: defaultHeadingInternal('h1'),
|
|
152
|
+
h2: defaultHeadingInternal('h2'),
|
|
153
|
+
h3: defaultHeadingInternal('h3'),
|
|
154
|
+
h4: defaultHeadingInternal('h4'),
|
|
155
|
+
h5: defaultHeadingInternal('h5'),
|
|
156
|
+
h6: defaultHeadingInternal('h6'),
|
|
157
|
+
list: {
|
|
158
|
+
itemSpacing: 0,
|
|
159
|
+
},
|
|
119
160
|
});
|
|
120
161
|
|
|
162
|
+
const normalizeHeadingStyle = (
|
|
163
|
+
key: HeadingLevelKey,
|
|
164
|
+
style: HeadingStyle | undefined
|
|
165
|
+
): HeadingStyleInternal => {
|
|
166
|
+
const fallback = defaultInternal[key];
|
|
167
|
+
return {
|
|
168
|
+
fontSize: style?.fontSize ?? fallback.fontSize,
|
|
169
|
+
fontWeight: style?.fontWeight ?? fallback.fontWeight,
|
|
170
|
+
color: normalizeColor(style?.color) ?? fallback.color,
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
|
|
121
174
|
let cachedInput: MarkdownTextInputStyle | undefined;
|
|
122
175
|
let cachedResult: MarkdownTextInputStyleInternal | undefined;
|
|
123
176
|
|
|
@@ -133,10 +186,10 @@ function normalizeInputLinkStyle(
|
|
|
133
186
|
};
|
|
134
187
|
}
|
|
135
188
|
|
|
136
|
-
function
|
|
137
|
-
style:
|
|
138
|
-
fallback:
|
|
139
|
-
):
|
|
189
|
+
function normalizeInlineMathStyle(
|
|
190
|
+
style: InputInlineMathStyle | undefined,
|
|
191
|
+
fallback: InputInlineMathStyleInternal
|
|
192
|
+
): InputInlineMathStyleInternal {
|
|
140
193
|
const color = normalizeColor(style?.color) ?? fallback.color;
|
|
141
194
|
const backgroundColor =
|
|
142
195
|
normalizeColor(style?.backgroundColor) ?? fallback.backgroundColor;
|
|
@@ -159,12 +212,14 @@ function normalizeMathStyle(
|
|
|
159
212
|
};
|
|
160
213
|
}
|
|
161
214
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
215
|
+
// Block math (`markdownStyle.math`). Inherits the chip look from the inline
|
|
216
|
+
// key so a single override styles both, then applies its own block-only fields.
|
|
217
|
+
function normalizeBlockMathStyle(
|
|
218
|
+
style: InputMathStyle | undefined,
|
|
219
|
+
baseInline: InputInlineMathStyleInternal,
|
|
220
|
+
fallback: InputMathStyleInternal
|
|
221
|
+
): InputMathStyleInternal {
|
|
222
|
+
const merged: InputInlineMathStyleInternal = {
|
|
168
223
|
color: baseInline.color,
|
|
169
224
|
fontSize: fallback.fontSize,
|
|
170
225
|
backgroundColor: baseInline.backgroundColor,
|
|
@@ -177,20 +232,28 @@ function normalizeMathBlockStyle(
|
|
|
177
232
|
selectedBorderColor: baseInline.selectedBorderColor,
|
|
178
233
|
fontWeight: baseInline.fontWeight,
|
|
179
234
|
};
|
|
180
|
-
const inheritedInline =
|
|
181
|
-
let
|
|
235
|
+
const inheritedInline = normalizeInlineMathStyle(style, merged);
|
|
236
|
+
let textAlign: 'left' | 'center' | 'right' = fallback.textAlign;
|
|
182
237
|
if (
|
|
183
|
-
style?.
|
|
184
|
-
style?.
|
|
185
|
-
style?.
|
|
238
|
+
style?.textAlign === 'left' ||
|
|
239
|
+
style?.textAlign === 'center' ||
|
|
240
|
+
style?.textAlign === 'right'
|
|
186
241
|
) {
|
|
187
|
-
|
|
242
|
+
textAlign = style.textAlign;
|
|
188
243
|
}
|
|
244
|
+
// `padding` is the renderer-compatible shorthand; the per-axis fields win
|
|
245
|
+
// when both are given. Resolved here so the bridge only ever carries the
|
|
246
|
+
// two axes and no native side has to know about the shorthand.
|
|
247
|
+
const padding = style?.padding;
|
|
189
248
|
return {
|
|
190
249
|
...inheritedInline,
|
|
250
|
+
paddingHorizontal:
|
|
251
|
+
style?.paddingHorizontal ?? padding ?? inheritedInline.paddingHorizontal,
|
|
252
|
+
paddingVertical:
|
|
253
|
+
style?.paddingVertical ?? padding ?? inheritedInline.paddingVertical,
|
|
191
254
|
marginTop: style?.marginTop ?? fallback.marginTop,
|
|
192
255
|
marginBottom: style?.marginBottom ?? fallback.marginBottom,
|
|
193
|
-
|
|
256
|
+
textAlign,
|
|
194
257
|
};
|
|
195
258
|
}
|
|
196
259
|
|
|
@@ -231,14 +294,26 @@ export const normalizeMarkdownTextInputStyle = (
|
|
|
231
294
|
normalizeColor(style.spoiler?.backgroundColor) ??
|
|
232
295
|
defaultInternal.spoiler.backgroundColor,
|
|
233
296
|
},
|
|
234
|
-
|
|
235
|
-
|
|
297
|
+
inlineMath: normalizeInlineMathStyle(
|
|
298
|
+
style.inlineMath,
|
|
299
|
+
defaultInternal.inlineMath
|
|
300
|
+
),
|
|
301
|
+
math: defaultInternal.math,
|
|
302
|
+
h1: normalizeHeadingStyle('h1', style.h1),
|
|
303
|
+
h2: normalizeHeadingStyle('h2', style.h2),
|
|
304
|
+
h3: normalizeHeadingStyle('h3', style.h3),
|
|
305
|
+
h4: normalizeHeadingStyle('h4', style.h4),
|
|
306
|
+
h5: normalizeHeadingStyle('h5', style.h5),
|
|
307
|
+
h6: normalizeHeadingStyle('h6', style.h6),
|
|
308
|
+
list: {
|
|
309
|
+
itemSpacing: style.list?.itemSpacing ?? defaultInternal.list.itemSpacing,
|
|
310
|
+
},
|
|
236
311
|
};
|
|
237
312
|
|
|
238
|
-
result.
|
|
239
|
-
style.
|
|
240
|
-
result.
|
|
241
|
-
defaultInternal.
|
|
313
|
+
result.math = normalizeBlockMathStyle(
|
|
314
|
+
style.math,
|
|
315
|
+
result.inlineMath,
|
|
316
|
+
defaultInternal.math
|
|
242
317
|
);
|
|
243
318
|
|
|
244
319
|
cachedInput = style;
|
package/src/normalizeMenuItem.ts
CHANGED
|
@@ -43,7 +43,7 @@ export const normalizeLegacyBooleanMenuItem = (
|
|
|
43
43
|
if (typeof raw === 'boolean') {
|
|
44
44
|
warnOnce(
|
|
45
45
|
`${parentProp}.${field}`,
|
|
46
|
-
`[react-native-enriched-markdown] ${parentProp}.${field} as a boolean is ` +
|
|
46
|
+
`[react-native-enriched-markdown-scaffold] ${parentProp}.${field} as a boolean is ` +
|
|
47
47
|
`deprecated; use { enabled: ${raw} }. The boolean form will be removed in 0.8.`
|
|
48
48
|
);
|
|
49
49
|
return { enabled: raw, label: defaultLabel };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
type TextAlign = 'auto' | 'left' | 'right' | 'center' | 'justify';
|
|
2
2
|
|
|
3
|
+
type ImageResizeMode = 'contain' | 'cover' | 'stretch' | 'center' | 'none';
|
|
4
|
+
|
|
3
5
|
interface BaseBlockStyle {
|
|
4
6
|
fontSize?: number;
|
|
5
7
|
fontFamily?: string;
|
|
@@ -23,6 +25,8 @@ interface BlockquoteStyle extends BaseBlockStyle {
|
|
|
23
25
|
borderWidth?: number;
|
|
24
26
|
gapWidth?: number;
|
|
25
27
|
backgroundColor?: string;
|
|
28
|
+
borderRadius?: number;
|
|
29
|
+
padding?: number;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
interface ListStyle extends BaseBlockStyle {
|
|
@@ -37,6 +41,38 @@ interface ListStyle extends BaseBlockStyle {
|
|
|
37
41
|
markerFontWeight?: string;
|
|
38
42
|
gapWidth?: number;
|
|
39
43
|
marginLeft?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Vertical spacing between consecutive list items, including nested ones.
|
|
46
|
+
* Adds no space above the first item or below the last one — the outer
|
|
47
|
+
* edges are still controlled by `marginTop`/`marginBottom`.
|
|
48
|
+
* @default 0
|
|
49
|
+
*/
|
|
50
|
+
itemSpacing?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Per-token syntax highlight colors for fenced code blocks, keyed on the
|
|
55
|
+
* tree-sitter highlight token types. Any key omitted falls back to the default
|
|
56
|
+
* palette (Operator/Punctuation/Variable/Embedded inherit the code block's
|
|
57
|
+
* base `color`). Colors only take visible effect when the optional syntax
|
|
58
|
+
* highlighting module is compiled in; otherwise code blocks render uncolored.
|
|
59
|
+
*/
|
|
60
|
+
interface CodeBlockSyntaxColors {
|
|
61
|
+
keyword?: string;
|
|
62
|
+
/** Color for operator tokens (e.g. `+`, `=>`). */
|
|
63
|
+
operator?: string;
|
|
64
|
+
punctuation?: string;
|
|
65
|
+
string?: string;
|
|
66
|
+
number?: string;
|
|
67
|
+
constant?: string;
|
|
68
|
+
comment?: string;
|
|
69
|
+
function?: string;
|
|
70
|
+
type?: string;
|
|
71
|
+
variable?: string;
|
|
72
|
+
property?: string;
|
|
73
|
+
tag?: string;
|
|
74
|
+
attribute?: string;
|
|
75
|
+
embedded?: string;
|
|
40
76
|
}
|
|
41
77
|
|
|
42
78
|
interface CodeBlockStyle extends BaseBlockStyle {
|
|
@@ -45,19 +81,42 @@ interface CodeBlockStyle extends BaseBlockStyle {
|
|
|
45
81
|
borderRadius?: number;
|
|
46
82
|
borderWidth?: number;
|
|
47
83
|
padding?: number;
|
|
84
|
+
syntaxColors?: CodeBlockSyntaxColors;
|
|
48
85
|
}
|
|
49
86
|
|
|
50
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Chip ("box") properties shared by `link` and `linkVariants`. Unlike `color`
|
|
89
|
+
* and `underline`, these never inherit from the base `link` style: a variant
|
|
90
|
+
* that omits them renders without a chip (`0` / `transparent`).
|
|
91
|
+
*/
|
|
92
|
+
interface LinkChipStyle {
|
|
93
|
+
backgroundColor?: string;
|
|
94
|
+
/** Corner radius of the chip, in dp. */
|
|
95
|
+
borderRadius?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Horizontal padding, in dp. Reserves real space in the line on both outer
|
|
98
|
+
* edges of the link (affects measurement and wrapping).
|
|
99
|
+
*/
|
|
100
|
+
paddingHorizontal?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Vertical padding, in dp. Only affects the drawn chip (it bleeds into the
|
|
103
|
+
* surrounding line spacing); the line box is unchanged.
|
|
104
|
+
*/
|
|
105
|
+
paddingVertical?: number;
|
|
106
|
+
borderColor?: string;
|
|
107
|
+
/** Border width, in dp. Drawn inset, within the chip bounds. */
|
|
108
|
+
borderWidth?: number;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface LinkStyle extends LinkChipStyle {
|
|
51
112
|
fontFamily?: string;
|
|
52
113
|
color?: string;
|
|
53
114
|
underline?: boolean;
|
|
54
|
-
backgroundColor?: string;
|
|
55
115
|
}
|
|
56
116
|
|
|
57
|
-
export interface LinkVariantStyle {
|
|
117
|
+
export interface LinkVariantStyle extends LinkChipStyle {
|
|
58
118
|
color?: string;
|
|
59
119
|
underline?: boolean;
|
|
60
|
-
backgroundColor?: string;
|
|
61
120
|
}
|
|
62
121
|
|
|
63
122
|
interface StrongStyle {
|
|
@@ -108,6 +167,26 @@ interface CodeStyle {
|
|
|
108
167
|
|
|
109
168
|
interface ImageStyle {
|
|
110
169
|
height?: number;
|
|
170
|
+
/**
|
|
171
|
+
* Maximum height the image is fitted into, preserving aspect ratio. When set,
|
|
172
|
+
* this replaces `height` as the primary sizing knob. Ignored when `aspectRatio`
|
|
173
|
+
* is set. Sizing precedence: `aspectRatio` > `maxHeight` > `height`.
|
|
174
|
+
*/
|
|
175
|
+
maxHeight?: number;
|
|
176
|
+
/**
|
|
177
|
+
* Width / height ratio (e.g. `16 / 9`). The image fills the available width and
|
|
178
|
+
* its height is derived from this ratio, ignoring `height`/`maxHeight`.
|
|
179
|
+
* Sizing precedence: `aspectRatio` > `maxHeight` > `height`.
|
|
180
|
+
*/
|
|
181
|
+
aspectRatio?: number;
|
|
182
|
+
/**
|
|
183
|
+
* How the image fills its box, analogous to React Native `resizeMode` / CSS
|
|
184
|
+
* `object-fit`. Applies whenever set explicitly, including with a fixed
|
|
185
|
+
* `height` box. When omitted, block images keep the legacy fill-width
|
|
186
|
+
* behavior, unless `maxHeight` or `aspectRatio` is set — then it defaults
|
|
187
|
+
* to `'cover'`.
|
|
188
|
+
*/
|
|
189
|
+
resizeMode?: ImageResizeMode;
|
|
111
190
|
borderRadius?: number;
|
|
112
191
|
marginTop?: number;
|
|
113
192
|
marginBottom?: number;
|
|
@@ -135,6 +214,16 @@ interface TableStyle extends BaseBlockStyle {
|
|
|
135
214
|
borderRadius?: number;
|
|
136
215
|
cellPaddingHorizontal?: number;
|
|
137
216
|
cellPaddingVertical?: number;
|
|
217
|
+
horizontalOverflow?: number;
|
|
218
|
+
/**
|
|
219
|
+
* Horizontal alignment of the whole table within the container. Only applies
|
|
220
|
+
* when the table is narrower than the container; tables that overflow and
|
|
221
|
+
* scroll always start at the table's beginning. When unset, tables keep the
|
|
222
|
+
* legacy start-aligned placement. On web, setting any value (including
|
|
223
|
+
* 'left') also makes the table shrink to fit its content instead of filling
|
|
224
|
+
* the container width.
|
|
225
|
+
*/
|
|
226
|
+
align?: 'left' | 'center' | 'right';
|
|
138
227
|
}
|
|
139
228
|
|
|
140
229
|
interface TaskListStyle {
|
|
@@ -167,6 +256,17 @@ interface MathStyle {
|
|
|
167
256
|
* @default 'normal'
|
|
168
257
|
*/
|
|
169
258
|
fontWeight?: 'bold' | 'normal';
|
|
259
|
+
/**
|
|
260
|
+
* Headroom kept above and below the rendered formula, in points (dp on
|
|
261
|
+
* Android), inside the box the formula reports. The math engine sizes a
|
|
262
|
+
* formula by its TeX metric box, and digit and capital outlines — plus the
|
|
263
|
+
* synthetic-bold stroke — rise a little past it; without this headroom that
|
|
264
|
+
* ink is clipped at the top of the box. About `0.06 × fontSize` covers the
|
|
265
|
+
* KaTeX faces; add `0.02 × fontSize` when `fontWeight` is `'bold'`.
|
|
266
|
+
* Android rounds it up to whole pixels.
|
|
267
|
+
* @default 0
|
|
268
|
+
*/
|
|
269
|
+
glyphOverflow?: number;
|
|
170
270
|
}
|
|
171
271
|
|
|
172
272
|
interface InlineMathStyle {
|
|
@@ -191,6 +291,17 @@ interface InlineMathStyle {
|
|
|
191
291
|
* @default 'normal'
|
|
192
292
|
*/
|
|
193
293
|
fontWeight?: 'bold' | 'normal';
|
|
294
|
+
/**
|
|
295
|
+
* Headroom kept above and below the rendered formula, in points (dp on
|
|
296
|
+
* Android), inside the box the formula reports. The math engine sizes a
|
|
297
|
+
* formula by its TeX metric box, and digit and capital outlines — plus the
|
|
298
|
+
* synthetic-bold stroke — rise a little past it; without this headroom that
|
|
299
|
+
* ink is clipped at the top of the box. About `0.06 × fontSize` covers the
|
|
300
|
+
* KaTeX faces; add `0.02 × fontSize` when `fontWeight` is `'bold'`.
|
|
301
|
+
* Android rounds it up to whole pixels.
|
|
302
|
+
* @default 0
|
|
303
|
+
*/
|
|
304
|
+
glyphOverflow?: number;
|
|
194
305
|
}
|
|
195
306
|
|
|
196
307
|
interface SpoilerParticlesStyle {
|
|
@@ -283,7 +394,9 @@ export interface MarkdownStyle {
|
|
|
283
394
|
* specific patterns take precedence.
|
|
284
395
|
*
|
|
285
396
|
* `color` and `underline` inherit from the base `link` style when omitted.
|
|
286
|
-
* `backgroundColor`
|
|
397
|
+
* Chip properties (`backgroundColor`, `borderRadius`, `paddingHorizontal`,
|
|
398
|
+
* `paddingVertical`, `borderColor`, `borderWidth`) do not inherit: when
|
|
399
|
+
* omitted they default to `0` / `transparent`.
|
|
287
400
|
* `fontFamily` always follows the base `link` style and cannot be overridden per-variant.
|
|
288
401
|
*
|
|
289
402
|
* @example
|
|
@@ -355,4 +468,11 @@ export interface Md4cFlags {
|
|
|
355
468
|
* @default false
|
|
356
469
|
*/
|
|
357
470
|
highlight?: boolean;
|
|
471
|
+
/**
|
|
472
|
+
* Treat soft breaks (single newlines) as hard breaks (visible line breaks).
|
|
473
|
+
* When enabled, a single newline in the source renders as a line break
|
|
474
|
+
* instead of being collapsed to a space (CommonMark default).
|
|
475
|
+
* @default false
|
|
476
|
+
*/
|
|
477
|
+
hardSoftBreaks?: boolean;
|
|
358
478
|
}
|