react-native-enriched-markdown-scaffold 0.7.4-scaffold.6 → 0.7.4-scaffold.8
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/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +48 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/MeasurementStore.kt +4 -3
- package/android/src/main/java/com/swmansion/enriched/markdown/input/model/MathChipStyle.kt +3 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/InlineMathStyle.kt +5 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/MathFontWeight.kt +25 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/styles/MathStyle.kt +12 -1
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/input/MarkdownStyleParser.kt +10 -0
- package/android/src/main/java/com/swmansion/enriched/markdown/utils/text/extensions/SpannableExtensions.kt +12 -4
- package/android/src/main/java/com/swmansion/enriched/markdown/views/TableContainerView.kt +1 -1
- package/android/src/math/java/com/swmansion/enriched/markdown/renderer/MathInlineRenderer.kt +2 -0
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathChipSpan.kt +1 -1
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathInlinePlaceholderSpan.kt +7 -3
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathInlineSpan.kt +8 -5
- package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathTypeface.kt +30 -0
- package/android/src/math/java/com/swmansion/enriched/markdown/views/MathContainerView.kt +3 -1
- package/docs/INPUT.md +4 -0
- package/docs/LATEX_MATH.md +62 -0
- package/docs/STYLES.md +3 -0
- package/ios/attachments/ENRMMathInlineAttachment+macOS.m +5 -1
- package/ios/attachments/ENRMMathInlineAttachment.h +3 -0
- package/ios/attachments/ENRMMathInlineAttachment.m +2 -1
- package/ios/generated/ReactCodegen/EnrichedMarkdownTextSpec/Props.h +48 -0
- package/ios/input/ENRMInputFormatter.h +4 -0
- package/ios/input/ENRMInputFormatter.mm +2 -0
- package/ios/input/EnrichedMarkdownTextInput.mm +3 -0
- package/ios/input/InputStylePropsUtils.h +13 -0
- package/ios/internals/MeasurementCache.h +1 -0
- package/ios/math/ENRMRaTeXBridge.swift +52 -3
- package/ios/renderer/ENRMMathInlineRenderer.m +3 -0
- package/ios/styles/StyleConfig.h +6 -0
- package/ios/styles/StyleConfig.mm +36 -0
- package/ios/utils/ENRMMathFontWeight.h +18 -0
- package/ios/utils/StylePropsUtils.h +21 -0
- package/ios/views/ENRMMathContainerView.m +3 -1
- package/lib/module/EnrichedMarkdownNativeComponent.ts +3 -0
- package/lib/module/EnrichedMarkdownTextInput.js.map +1 -1
- package/lib/module/EnrichedMarkdownTextInputNativeComponent.ts +1 -0
- package/lib/module/EnrichedMarkdownTextNativeComponent.ts +3 -0
- package/lib/module/normalizeMarkdownStyle.js +5 -2
- package/lib/module/normalizeMarkdownStyle.js.map +1 -1
- package/lib/module/normalizeMarkdownStyle.web.js +5 -2
- package/lib/module/normalizeMarkdownStyle.web.js.map +1 -1
- package/lib/module/normalizeMarkdownTextInputStyle.js +7 -3
- package/lib/module/normalizeMarkdownTextInputStyle.js.map +1 -1
- package/lib/module/web/globalStyles.js +8 -1
- package/lib/module/web/globalStyles.js.map +1 -1
- package/lib/module/web/styles.js +3 -1
- package/lib/module/web/styles.js.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts +3 -0
- package/lib/typescript/src/EnrichedMarkdownNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts +1 -0
- package/lib/typescript/src/EnrichedMarkdownTextInput.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts +1 -0
- package/lib/typescript/src/EnrichedMarkdownTextInputNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +3 -0
- package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.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 +1 -0
- package/lib/typescript/src/normalizeMarkdownTextInputStyle.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownStyle.d.ts +32 -0
- package/lib/typescript/src/types/MarkdownStyle.d.ts.map +1 -1
- package/lib/typescript/src/types/MarkdownStyleInternal.d.ts +3 -0
- package/lib/typescript/src/types/MarkdownStyleInternal.d.ts.map +1 -1
- package/lib/typescript/src/web/styles.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/EnrichedMarkdownNativeComponent.ts +3 -0
- package/src/EnrichedMarkdownTextInput.tsx +1 -0
- package/src/EnrichedMarkdownTextInputNativeComponent.ts +1 -0
- package/src/EnrichedMarkdownTextNativeComponent.ts +3 -0
- package/src/normalizeMarkdownStyle.ts +6 -1
- package/src/normalizeMarkdownStyle.web.ts +6 -1
- package/src/normalizeMarkdownTextInputStyle.ts +5 -0
- package/src/types/MarkdownStyle.ts +32 -0
- package/src/types/MarkdownStyleInternal.ts +3 -0
- package/src/web/globalStyles.ts +7 -0
- package/src/web/styles.ts +5 -1
|
@@ -1534,6 +1534,7 @@ struct EnrichedMarkdownMarkdownStyleMathStruct {
|
|
|
1534
1534
|
Float marginTop{0.0};
|
|
1535
1535
|
Float marginBottom{0.0};
|
|
1536
1536
|
std::string textAlign{};
|
|
1537
|
+
std::string fontWeight{};
|
|
1537
1538
|
|
|
1538
1539
|
|
|
1539
1540
|
#ifdef RN_SERIALIZABLE_STATE
|
|
@@ -1548,6 +1549,7 @@ struct EnrichedMarkdownMarkdownStyleMathStruct {
|
|
|
1548
1549
|
result["marginTop"] = marginTop;
|
|
1549
1550
|
result["marginBottom"] = marginBottom;
|
|
1550
1551
|
result["textAlign"] = textAlign;
|
|
1552
|
+
result["fontWeight"] = fontWeight;
|
|
1551
1553
|
return result;
|
|
1552
1554
|
}
|
|
1553
1555
|
#endif
|
|
@@ -1584,6 +1586,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
1584
1586
|
if (tmp_textAlign != map.end()) {
|
|
1585
1587
|
fromRawValue(context, tmp_textAlign->second, result.textAlign);
|
|
1586
1588
|
}
|
|
1589
|
+
auto tmp_fontWeight = map.find("fontWeight");
|
|
1590
|
+
if (tmp_fontWeight != map.end()) {
|
|
1591
|
+
fromRawValue(context, tmp_fontWeight->second, result.fontWeight);
|
|
1592
|
+
}
|
|
1587
1593
|
}
|
|
1588
1594
|
|
|
1589
1595
|
static inline std::string toString(const EnrichedMarkdownMarkdownStyleMathStruct &value) {
|
|
@@ -1598,6 +1604,8 @@ static inline folly::dynamic toDynamic(const EnrichedMarkdownMarkdownStyleMathSt
|
|
|
1598
1604
|
|
|
1599
1605
|
struct EnrichedMarkdownMarkdownStyleInlineMathStruct {
|
|
1600
1606
|
SharedColor color{};
|
|
1607
|
+
Float paddingVertical{0.0};
|
|
1608
|
+
std::string fontWeight{};
|
|
1601
1609
|
|
|
1602
1610
|
|
|
1603
1611
|
#ifdef RN_SERIALIZABLE_STATE
|
|
@@ -1606,6 +1614,8 @@ struct EnrichedMarkdownMarkdownStyleInlineMathStruct {
|
|
|
1606
1614
|
folly::dynamic toDynamic() const {
|
|
1607
1615
|
folly::dynamic result = folly::dynamic::object();
|
|
1608
1616
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
1617
|
+
result["paddingVertical"] = paddingVertical;
|
|
1618
|
+
result["fontWeight"] = fontWeight;
|
|
1609
1619
|
return result;
|
|
1610
1620
|
}
|
|
1611
1621
|
#endif
|
|
@@ -1618,6 +1628,14 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
1618
1628
|
if (tmp_color != map.end()) {
|
|
1619
1629
|
fromRawValue(context, tmp_color->second, result.color);
|
|
1620
1630
|
}
|
|
1631
|
+
auto tmp_paddingVertical = map.find("paddingVertical");
|
|
1632
|
+
if (tmp_paddingVertical != map.end()) {
|
|
1633
|
+
fromRawValue(context, tmp_paddingVertical->second, result.paddingVertical);
|
|
1634
|
+
}
|
|
1635
|
+
auto tmp_fontWeight = map.find("fontWeight");
|
|
1636
|
+
if (tmp_fontWeight != map.end()) {
|
|
1637
|
+
fromRawValue(context, tmp_fontWeight->second, result.fontWeight);
|
|
1638
|
+
}
|
|
1621
1639
|
}
|
|
1622
1640
|
|
|
1623
1641
|
static inline std::string toString(const EnrichedMarkdownMarkdownStyleInlineMathStruct &value) {
|
|
@@ -2804,6 +2822,7 @@ struct EnrichedMarkdownTextInputMarkdownStyleMathStruct {
|
|
|
2804
2822
|
Float paddingVertical{0.0};
|
|
2805
2823
|
SharedColor selectedBackgroundColor{};
|
|
2806
2824
|
SharedColor selectedBorderColor{};
|
|
2825
|
+
std::string fontWeight{};
|
|
2807
2826
|
|
|
2808
2827
|
|
|
2809
2828
|
#ifdef RN_SERIALIZABLE_STATE
|
|
@@ -2821,6 +2840,7 @@ struct EnrichedMarkdownTextInputMarkdownStyleMathStruct {
|
|
|
2821
2840
|
result["paddingVertical"] = paddingVertical;
|
|
2822
2841
|
result["selectedBackgroundColor"] = ::facebook::react::toDynamic(selectedBackgroundColor);
|
|
2823
2842
|
result["selectedBorderColor"] = ::facebook::react::toDynamic(selectedBorderColor);
|
|
2843
|
+
result["fontWeight"] = fontWeight;
|
|
2824
2844
|
return result;
|
|
2825
2845
|
}
|
|
2826
2846
|
#endif
|
|
@@ -2869,6 +2889,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
2869
2889
|
if (tmp_selectedBorderColor != map.end()) {
|
|
2870
2890
|
fromRawValue(context, tmp_selectedBorderColor->second, result.selectedBorderColor);
|
|
2871
2891
|
}
|
|
2892
|
+
auto tmp_fontWeight = map.find("fontWeight");
|
|
2893
|
+
if (tmp_fontWeight != map.end()) {
|
|
2894
|
+
fromRawValue(context, tmp_fontWeight->second, result.fontWeight);
|
|
2895
|
+
}
|
|
2872
2896
|
}
|
|
2873
2897
|
|
|
2874
2898
|
static inline std::string toString(const EnrichedMarkdownTextInputMarkdownStyleMathStruct &value) {
|
|
@@ -2892,6 +2916,7 @@ struct EnrichedMarkdownTextInputMarkdownStyleMathBlockStruct {
|
|
|
2892
2916
|
Float paddingVertical{0.0};
|
|
2893
2917
|
SharedColor selectedBackgroundColor{};
|
|
2894
2918
|
SharedColor selectedBorderColor{};
|
|
2919
|
+
std::string fontWeight{};
|
|
2895
2920
|
Float marginTop{0.0};
|
|
2896
2921
|
Float marginBottom{0.0};
|
|
2897
2922
|
std::string alignment{};
|
|
@@ -2912,6 +2937,7 @@ struct EnrichedMarkdownTextInputMarkdownStyleMathBlockStruct {
|
|
|
2912
2937
|
result["paddingVertical"] = paddingVertical;
|
|
2913
2938
|
result["selectedBackgroundColor"] = ::facebook::react::toDynamic(selectedBackgroundColor);
|
|
2914
2939
|
result["selectedBorderColor"] = ::facebook::react::toDynamic(selectedBorderColor);
|
|
2940
|
+
result["fontWeight"] = fontWeight;
|
|
2915
2941
|
result["marginTop"] = marginTop;
|
|
2916
2942
|
result["marginBottom"] = marginBottom;
|
|
2917
2943
|
result["alignment"] = alignment;
|
|
@@ -2963,6 +2989,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
2963
2989
|
if (tmp_selectedBorderColor != map.end()) {
|
|
2964
2990
|
fromRawValue(context, tmp_selectedBorderColor->second, result.selectedBorderColor);
|
|
2965
2991
|
}
|
|
2992
|
+
auto tmp_fontWeight = map.find("fontWeight");
|
|
2993
|
+
if (tmp_fontWeight != map.end()) {
|
|
2994
|
+
fromRawValue(context, tmp_fontWeight->second, result.fontWeight);
|
|
2995
|
+
}
|
|
2966
2996
|
auto tmp_marginTop = map.find("marginTop");
|
|
2967
2997
|
if (tmp_marginTop != map.end()) {
|
|
2968
2998
|
fromRawValue(context, tmp_marginTop->second, result.marginTop);
|
|
@@ -4872,6 +4902,7 @@ struct EnrichedMarkdownTextMarkdownStyleMathStruct {
|
|
|
4872
4902
|
Float marginTop{0.0};
|
|
4873
4903
|
Float marginBottom{0.0};
|
|
4874
4904
|
std::string textAlign{};
|
|
4905
|
+
std::string fontWeight{};
|
|
4875
4906
|
|
|
4876
4907
|
|
|
4877
4908
|
#ifdef RN_SERIALIZABLE_STATE
|
|
@@ -4886,6 +4917,7 @@ struct EnrichedMarkdownTextMarkdownStyleMathStruct {
|
|
|
4886
4917
|
result["marginTop"] = marginTop;
|
|
4887
4918
|
result["marginBottom"] = marginBottom;
|
|
4888
4919
|
result["textAlign"] = textAlign;
|
|
4920
|
+
result["fontWeight"] = fontWeight;
|
|
4889
4921
|
return result;
|
|
4890
4922
|
}
|
|
4891
4923
|
#endif
|
|
@@ -4922,6 +4954,10 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
4922
4954
|
if (tmp_textAlign != map.end()) {
|
|
4923
4955
|
fromRawValue(context, tmp_textAlign->second, result.textAlign);
|
|
4924
4956
|
}
|
|
4957
|
+
auto tmp_fontWeight = map.find("fontWeight");
|
|
4958
|
+
if (tmp_fontWeight != map.end()) {
|
|
4959
|
+
fromRawValue(context, tmp_fontWeight->second, result.fontWeight);
|
|
4960
|
+
}
|
|
4925
4961
|
}
|
|
4926
4962
|
|
|
4927
4963
|
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleMathStruct &value) {
|
|
@@ -4936,6 +4972,8 @@ static inline folly::dynamic toDynamic(const EnrichedMarkdownTextMarkdownStyleMa
|
|
|
4936
4972
|
|
|
4937
4973
|
struct EnrichedMarkdownTextMarkdownStyleInlineMathStruct {
|
|
4938
4974
|
SharedColor color{};
|
|
4975
|
+
Float paddingVertical{0.0};
|
|
4976
|
+
std::string fontWeight{};
|
|
4939
4977
|
|
|
4940
4978
|
|
|
4941
4979
|
#ifdef RN_SERIALIZABLE_STATE
|
|
@@ -4944,6 +4982,8 @@ struct EnrichedMarkdownTextMarkdownStyleInlineMathStruct {
|
|
|
4944
4982
|
folly::dynamic toDynamic() const {
|
|
4945
4983
|
folly::dynamic result = folly::dynamic::object();
|
|
4946
4984
|
result["color"] = ::facebook::react::toDynamic(color);
|
|
4985
|
+
result["paddingVertical"] = paddingVertical;
|
|
4986
|
+
result["fontWeight"] = fontWeight;
|
|
4947
4987
|
return result;
|
|
4948
4988
|
}
|
|
4949
4989
|
#endif
|
|
@@ -4956,6 +4996,14 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
|
|
4956
4996
|
if (tmp_color != map.end()) {
|
|
4957
4997
|
fromRawValue(context, tmp_color->second, result.color);
|
|
4958
4998
|
}
|
|
4999
|
+
auto tmp_paddingVertical = map.find("paddingVertical");
|
|
5000
|
+
if (tmp_paddingVertical != map.end()) {
|
|
5001
|
+
fromRawValue(context, tmp_paddingVertical->second, result.paddingVertical);
|
|
5002
|
+
}
|
|
5003
|
+
auto tmp_fontWeight = map.find("fontWeight");
|
|
5004
|
+
if (tmp_fontWeight != map.end()) {
|
|
5005
|
+
fromRawValue(context, tmp_fontWeight->second, result.fontWeight);
|
|
5006
|
+
}
|
|
4959
5007
|
}
|
|
4960
5008
|
|
|
4961
5009
|
static inline std::string toString(const EnrichedMarkdownTextMarkdownStyleInlineMathStruct &value) {
|
|
@@ -299,7 +299,6 @@ object MeasurementStore {
|
|
|
299
299
|
|
|
300
300
|
// 2. Render & Measure
|
|
301
301
|
val spannable = tryRenderMarkdown(markdown, styleMap, context, md4cFlags, allowFontScaling, maxFontSizeMultiplier)
|
|
302
|
-
spannable?.replaceMathSpansWithPlaceholders(context)
|
|
303
302
|
val textToMeasure = spannable ?: markdown
|
|
304
303
|
val (size, _) = measureWithLayout(width, textToMeasure, measurePaint, id)
|
|
305
304
|
|
|
@@ -420,7 +419,7 @@ object MeasurementStore {
|
|
|
420
419
|
|
|
421
420
|
when (segment) {
|
|
422
421
|
is RenderedSegment.Text -> {
|
|
423
|
-
segment.styledText.replaceMathSpansWithPlaceholders(context)
|
|
422
|
+
segment.styledText.replaceMathSpansWithPlaceholders(context, style.inlineMathStyle.paddingVertical)
|
|
424
423
|
|
|
425
424
|
val layout = createStaticLayout(segment.styledText, fontSize, widthPx, id)
|
|
426
425
|
totalHeightPx += layout.height
|
|
@@ -503,7 +502,9 @@ object MeasurementStore {
|
|
|
503
502
|
val ast = Parser.shared.parseMarkdown(markdown, md4cFlags) ?: return null
|
|
504
503
|
val style = StyleConfig(styleMap, context, allowFontScaling, maxFontSizeMultiplier)
|
|
505
504
|
measureRenderer.configure(style, context)
|
|
506
|
-
measureRenderer.renderDocument(ast, null)
|
|
505
|
+
measureRenderer.renderDocument(ast, null).apply {
|
|
506
|
+
replaceMathSpansWithPlaceholders(context, style.inlineMathStyle.paddingVertical)
|
|
507
|
+
}
|
|
507
508
|
} catch (e: Exception) {
|
|
508
509
|
Log.w(TAG, "Failed to render markdown for measurement, falling back to raw text", e)
|
|
509
510
|
null
|
|
@@ -13,6 +13,7 @@ open class MathChipStyle(
|
|
|
13
13
|
val paddingVertical: Float,
|
|
14
14
|
val selectedBackgroundColor: Int?,
|
|
15
15
|
val selectedBorderColor: Int?,
|
|
16
|
+
val fontWeight: String = "normal",
|
|
16
17
|
) {
|
|
17
18
|
open fun isBlock(): Boolean = false
|
|
18
19
|
}
|
|
@@ -28,6 +29,7 @@ class MathBlockStyle(
|
|
|
28
29
|
paddingVertical: Float,
|
|
29
30
|
selectedBackgroundColor: Int?,
|
|
30
31
|
selectedBorderColor: Int?,
|
|
32
|
+
fontWeight: String = "normal",
|
|
31
33
|
val marginTop: Float,
|
|
32
34
|
val marginBottom: Float,
|
|
33
35
|
val alignment: Layout.Alignment,
|
|
@@ -42,6 +44,7 @@ class MathBlockStyle(
|
|
|
42
44
|
paddingVertical,
|
|
43
45
|
selectedBackgroundColor,
|
|
44
46
|
selectedBorderColor,
|
|
47
|
+
fontWeight,
|
|
45
48
|
) {
|
|
46
49
|
override fun isBlock(): Boolean = true
|
|
47
50
|
}
|
|
@@ -4,6 +4,8 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
4
4
|
|
|
5
5
|
data class InlineMathStyle(
|
|
6
6
|
val color: Int,
|
|
7
|
+
val paddingVertical: Float,
|
|
8
|
+
val fontWeight: String,
|
|
7
9
|
) {
|
|
8
10
|
companion object {
|
|
9
11
|
fun fromReadableMap(
|
|
@@ -11,7 +13,9 @@ data class InlineMathStyle(
|
|
|
11
13
|
parser: StyleParser,
|
|
12
14
|
): InlineMathStyle {
|
|
13
15
|
val color = parser.parseColor(map, "color")
|
|
14
|
-
|
|
16
|
+
val paddingVertical = parser.toPixelFromDIP(map.getDouble("paddingVertical").toFloat())
|
|
17
|
+
val fontWeight = parser.parseString(map, "fontWeight", "normal")
|
|
18
|
+
return InlineMathStyle(color, paddingVertical, fontWeight)
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.swmansion.enriched.markdown.styles
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Weight a formula can actually be typeset at.
|
|
5
|
+
*
|
|
6
|
+
* The style model keeps `fontWeight` as a [String], the way every other
|
|
7
|
+
* `fontWeight` prop in the codebase does, so a value like `"600"` survives as
|
|
8
|
+
* far as the renderer. This enum is the narrowing step at that last hop — see
|
|
9
|
+
* `ratexTypefaceLoader`, the only caller — so adding a third weight is a
|
|
10
|
+
* compile error at the draw site rather than a value that silently falls back
|
|
11
|
+
* to regular. Mirrors ENRMMathFontWeight.h on iOS.
|
|
12
|
+
*/
|
|
13
|
+
enum class MathFontWeight {
|
|
14
|
+
NORMAL,
|
|
15
|
+
BOLD,
|
|
16
|
+
;
|
|
17
|
+
|
|
18
|
+
companion object {
|
|
19
|
+
fun fromString(value: String): MathFontWeight =
|
|
20
|
+
when (value.lowercase()) {
|
|
21
|
+
"bold" -> BOLD
|
|
22
|
+
else -> NORMAL
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -10,6 +10,7 @@ data class MathStyle(
|
|
|
10
10
|
val marginTop: Float,
|
|
11
11
|
val marginBottom: Float,
|
|
12
12
|
val textAlign: String,
|
|
13
|
+
val fontWeight: String,
|
|
13
14
|
) {
|
|
14
15
|
companion object {
|
|
15
16
|
fun fromReadableMap(
|
|
@@ -23,7 +24,17 @@ data class MathStyle(
|
|
|
23
24
|
val marginTop = parser.toPixelFromDIP(map.getDouble("marginTop").toFloat())
|
|
24
25
|
val marginBottom = parser.toPixelFromDIP(map.getDouble("marginBottom").toFloat())
|
|
25
26
|
val textAlign = parser.parseString(map, "textAlign", "center")
|
|
26
|
-
|
|
27
|
+
val fontWeight = parser.parseString(map, "fontWeight", "normal")
|
|
28
|
+
return MathStyle(
|
|
29
|
+
fontSize,
|
|
30
|
+
color,
|
|
31
|
+
backgroundColor,
|
|
32
|
+
padding,
|
|
33
|
+
marginTop,
|
|
34
|
+
marginBottom,
|
|
35
|
+
textAlign,
|
|
36
|
+
fontWeight,
|
|
37
|
+
)
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
40
|
}
|
package/android/src/main/java/com/swmansion/enriched/markdown/utils/input/MarkdownStyleParser.kt
CHANGED
|
@@ -76,6 +76,8 @@ object MarkdownStyleParser {
|
|
|
76
76
|
if (mathMap?.hasKey("selectedBackgroundColor") == true) mathMap.getInt("selectedBackgroundColor") else null
|
|
77
77
|
val selectedBorderColor =
|
|
78
78
|
if (mathMap?.hasKey("selectedBorderColor") == true) mathMap.getInt("selectedBorderColor") else null
|
|
79
|
+
val fontWeight =
|
|
80
|
+
(if (mathMap?.hasKey("fontWeight") == true) mathMap.getString("fontWeight") else null) ?: "normal"
|
|
79
81
|
|
|
80
82
|
return MathChipStyle(
|
|
81
83
|
color = color,
|
|
@@ -88,6 +90,7 @@ object MarkdownStyleParser {
|
|
|
88
90
|
paddingVertical = paddingVertical,
|
|
89
91
|
selectedBackgroundColor = nullIfTransparent(selectedBackgroundColor),
|
|
90
92
|
selectedBorderColor = nullIfTransparent(selectedBorderColor),
|
|
93
|
+
fontWeight = fontWeight,
|
|
91
94
|
)
|
|
92
95
|
}
|
|
93
96
|
|
|
@@ -143,6 +146,12 @@ object MarkdownStyleParser {
|
|
|
143
146
|
} else {
|
|
144
147
|
inlineFallback.selectedBorderColor
|
|
145
148
|
}
|
|
149
|
+
val fontWeight =
|
|
150
|
+
if (mathBlockMap?.hasKey("fontWeight") == true) {
|
|
151
|
+
mathBlockMap.getString("fontWeight") ?: "normal"
|
|
152
|
+
} else {
|
|
153
|
+
inlineFallback.fontWeight
|
|
154
|
+
}
|
|
146
155
|
val marginTop =
|
|
147
156
|
PixelUtil.toPixelFromDIP(
|
|
148
157
|
if (mathBlockMap?.hasKey("marginTop") == true) mathBlockMap.getDouble("marginTop").toFloat() else 8f,
|
|
@@ -170,6 +179,7 @@ object MarkdownStyleParser {
|
|
|
170
179
|
paddingVertical = paddingVertical,
|
|
171
180
|
selectedBackgroundColor = nullIfTransparent(selectedBackgroundColor),
|
|
172
181
|
selectedBorderColor = nullIfTransparent(selectedBorderColor),
|
|
182
|
+
fontWeight = fontWeight,
|
|
173
183
|
marginTop = marginTop,
|
|
174
184
|
marginBottom = marginBottom,
|
|
175
185
|
alignment = alignment,
|
|
@@ -14,8 +14,16 @@ fun SpannableStringBuilder.isInlineImage(): Boolean {
|
|
|
14
14
|
return lastChar != '\n' && lastChar != '\u200B'
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Swaps MathInlineSpans for MathInlinePlaceholderSpans safe for background-thread measurement.
|
|
19
|
+
*
|
|
20
|
+
* [paddingVertical] must be the same `inlineMath.paddingVertical` (in px) the real spans were
|
|
21
|
+
* built with, or the measured line box won't match the drawn one.
|
|
22
|
+
*/
|
|
23
|
+
fun SpannableString.replaceMathSpansWithPlaceholders(
|
|
24
|
+
context: Context,
|
|
25
|
+
paddingVertical: Float,
|
|
26
|
+
) {
|
|
19
27
|
if (!FeatureFlags.IS_MATH_ENABLED) return
|
|
20
28
|
|
|
21
29
|
try {
|
|
@@ -42,7 +50,7 @@ fun SpannableString.replaceMathSpansWithPlaceholders(context: Context) {
|
|
|
42
50
|
@Suppress("UNCHECKED_CAST")
|
|
43
51
|
val results = measureMethod.invoke(null, context, requests) as? List<MathMetrics> ?: return
|
|
44
52
|
|
|
45
|
-
val placeholderCtor = placeholderClass.getConstructor(MathMetrics::class.java)
|
|
53
|
+
val placeholderCtor = placeholderClass.getConstructor(MathMetrics::class.java, Float::class.javaPrimitiveType)
|
|
46
54
|
|
|
47
55
|
mathSpans.forEachIndexed { i, oldSpan ->
|
|
48
56
|
val metrics = results.getOrNull(i) ?: return@forEachIndexed
|
|
@@ -53,7 +61,7 @@ fun SpannableString.replaceMathSpansWithPlaceholders(context: Context) {
|
|
|
53
61
|
|
|
54
62
|
if (start != -1 && end != -1) {
|
|
55
63
|
removeSpan(oldSpan)
|
|
56
|
-
val newSpan = placeholderCtor.newInstance(metrics)
|
|
64
|
+
val newSpan = placeholderCtor.newInstance(metrics, paddingVertical)
|
|
57
65
|
setSpan(newSpan, start, end, flags)
|
|
58
66
|
}
|
|
59
67
|
}
|
|
@@ -456,7 +456,7 @@ class TableContainerView(
|
|
|
456
456
|
.apply { configure(config, context) }
|
|
457
457
|
.renderDocument(MarkdownASTNode(NodeType.Document, children = listOf(paragraph)), null, null)
|
|
458
458
|
}
|
|
459
|
-
styledText.replaceMathSpansWithPlaceholders(context)
|
|
459
|
+
styledText.replaceMathSpansWithPlaceholders(context, config.inlineMathStyle.paddingVertical)
|
|
460
460
|
if (isHeader && styledText.isNotEmpty()) {
|
|
461
461
|
styledText.setSpan(HeaderTypefaceSpan(headerTypeface), 0, styledText.length, 33)
|
|
462
462
|
}
|
package/android/src/math/java/com/swmansion/enriched/markdown/renderer/MathInlineRenderer.kt
CHANGED
|
@@ -35,6 +35,8 @@ class MathInlineRenderer(
|
|
|
35
35
|
latex = latex,
|
|
36
36
|
fontSize = blockStyle.fontSize,
|
|
37
37
|
textColor = config.style.inlineMathStyle.color,
|
|
38
|
+
paddingVertical = config.style.inlineMathStyle.paddingVertical,
|
|
39
|
+
fontWeight = config.style.inlineMathStyle.fontWeight,
|
|
38
40
|
)
|
|
39
41
|
|
|
40
42
|
builder.setSpan(span, start, end, SPAN_FLAGS_EXCLUSIVE_EXCLUSIVE)
|
|
@@ -66,7 +66,7 @@ class MathChipSpan(
|
|
|
66
66
|
displayMode = displayMode,
|
|
67
67
|
color = style.color,
|
|
68
68
|
)
|
|
69
|
-
val renderer = RaTeXRenderer(displayList, style.fontSize
|
|
69
|
+
val renderer = RaTeXRenderer(displayList, style.fontSize, ratexTypefaceLoader(style.fontWeight))
|
|
70
70
|
formulaWidth = renderer.widthPx
|
|
71
71
|
formulaAscent = renderer.heightPx
|
|
72
72
|
formulaDescent = renderer.depthPx
|
package/android/src/math/java/com/swmansion/enriched/markdown/spans/MathInlinePlaceholderSpan.kt
CHANGED
|
@@ -3,11 +3,12 @@ package com.swmansion.enriched.markdown.spans
|
|
|
3
3
|
import android.graphics.Canvas
|
|
4
4
|
import android.graphics.Paint
|
|
5
5
|
import android.text.style.ReplacementSpan
|
|
6
|
-
import kotlin.math.
|
|
6
|
+
import kotlin.math.ceil
|
|
7
7
|
|
|
8
8
|
/** Holds pre-computed math metrics for background-thread measurement. */
|
|
9
9
|
class MathInlinePlaceholderSpan(
|
|
10
10
|
private val metrics: MathMetrics,
|
|
11
|
+
private val paddingVertical: Float,
|
|
11
12
|
) : ReplacementSpan() {
|
|
12
13
|
override fun getSize(
|
|
13
14
|
paint: Paint,
|
|
@@ -17,9 +18,12 @@ class MathInlinePlaceholderSpan(
|
|
|
17
18
|
fm: Paint.FontMetricsInt?,
|
|
18
19
|
): Int {
|
|
19
20
|
fm?.apply {
|
|
20
|
-
|
|
21
|
+
// Must stay identical to MathInlineSpan.getSize — this span stands in for it
|
|
22
|
+
// during ShadowNode measurement, so any divergence shows up as a clipped or
|
|
23
|
+
// over-tall view. Same ceil, same padding, same expression.
|
|
24
|
+
ascent = -ceil(metrics.ascent + paddingVertical).toInt()
|
|
21
25
|
top = ascent
|
|
22
|
-
descent = metrics.descent.
|
|
26
|
+
descent = ceil(metrics.descent + paddingVertical).toInt()
|
|
23
27
|
bottom = descent
|
|
24
28
|
}
|
|
25
29
|
return metrics.width
|
|
@@ -6,7 +6,6 @@ import android.graphics.Canvas
|
|
|
6
6
|
import android.graphics.Paint
|
|
7
7
|
import android.text.style.ReplacementSpan
|
|
8
8
|
import io.ratex.RaTeXEngine
|
|
9
|
-
import io.ratex.RaTeXFontLoader
|
|
10
9
|
import io.ratex.RaTeXRenderer
|
|
11
10
|
import kotlin.math.ceil
|
|
12
11
|
|
|
@@ -15,6 +14,8 @@ class MathInlineSpan(
|
|
|
15
14
|
internal val latex: String,
|
|
16
15
|
internal val fontSize: Float,
|
|
17
16
|
private val textColor: Int,
|
|
17
|
+
private val paddingVertical: Float,
|
|
18
|
+
private val fontWeight: String = "normal",
|
|
18
19
|
) : ReplacementSpan() {
|
|
19
20
|
private var cachedBitmap: Bitmap? = null
|
|
20
21
|
private var cachedWidth = 0
|
|
@@ -28,7 +29,7 @@ class MathInlineSpan(
|
|
|
28
29
|
|
|
29
30
|
try {
|
|
30
31
|
val displayList = RaTeXEngine.parseBlocking(latex, displayMode = false, color = textColor)
|
|
31
|
-
val renderer = RaTeXRenderer(displayList, fontSize
|
|
32
|
+
val renderer = RaTeXRenderer(displayList, fontSize, ratexTypefaceLoader(fontWeight))
|
|
32
33
|
|
|
33
34
|
cachedWidth = renderer.widthPx.toInt().coerceAtLeast(1)
|
|
34
35
|
mathAscent = renderer.heightPx
|
|
@@ -62,10 +63,12 @@ class MathInlineSpan(
|
|
|
62
63
|
prepareResources()
|
|
63
64
|
|
|
64
65
|
fm?.apply {
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
// Must stay identical to MathInlinePlaceholderSpan.getSize: that span measures
|
|
67
|
+
// this one off the main thread, and a box that disagrees by even a pixel either
|
|
68
|
+
// clips the formula or eats the padding this field is here to add.
|
|
69
|
+
ascent = -ceil(mathAscent + paddingVertical).toInt()
|
|
67
70
|
top = ascent
|
|
68
|
-
descent =
|
|
71
|
+
descent = ceil(mathDescent + paddingVertical).toInt()
|
|
69
72
|
bottom = descent
|
|
70
73
|
}
|
|
71
74
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
package com.swmansion.enriched.markdown.spans
|
|
2
|
+
|
|
3
|
+
import android.graphics.Typeface
|
|
4
|
+
import com.swmansion.enriched.markdown.styles.MathFontWeight
|
|
5
|
+
import io.ratex.RaTeXFontLoader
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Typeface supplier for [io.ratex.RaTeXRenderer]. RaTeX resolves every glyph to
|
|
9
|
+
* a KaTeX font id and asks us for the face to draw it with.
|
|
10
|
+
*
|
|
11
|
+
* Takes the raw `fontWeight` string the style model carries — the same shape
|
|
12
|
+
* every other `fontWeight` prop keeps — and is the single place on Android that
|
|
13
|
+
* narrows it to a weight we can draw. Consumers pass the style through; nothing
|
|
14
|
+
* upstream has to know that only two weights are reachable today.
|
|
15
|
+
*
|
|
16
|
+
* Bold is SYNTHETIC: asking for [Typeface.BOLD] on a single-weight asset makes
|
|
17
|
+
* the platform embolden it, which preserves the advances RaTeX already laid the
|
|
18
|
+
* glyphs out with. Substituting the bundled KaTeX bold faces instead would not
|
|
19
|
+
* — their advances run up to 15% wider than the regular ones the layout
|
|
20
|
+
* reserved, so glyphs would collide. iOS reaches the same result by stroking
|
|
21
|
+
* the glyph outline; see ENRMRaTeXBridge.
|
|
22
|
+
*/
|
|
23
|
+
internal fun ratexTypefaceLoader(fontWeight: String): (String) -> Typeface? =
|
|
24
|
+
when (MathFontWeight.fromString(fontWeight)) {
|
|
25
|
+
MathFontWeight.NORMAL -> { fontId -> RaTeXFontLoader.getTypeface(fontId) }
|
|
26
|
+
|
|
27
|
+
MathFontWeight.BOLD -> { fontId ->
|
|
28
|
+
RaTeXFontLoader.getTypeface(fontId)?.let { Typeface.create(it, Typeface.BOLD) }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -15,6 +15,7 @@ import com.swmansion.enriched.markdown.accessibility.AccessibilityLabels
|
|
|
15
15
|
import com.swmansion.enriched.markdown.spans.MathMeasureHelper
|
|
16
16
|
import com.swmansion.enriched.markdown.spans.MathMeasureRequest
|
|
17
17
|
import com.swmansion.enriched.markdown.spans.MathRenderMode
|
|
18
|
+
import com.swmansion.enriched.markdown.spans.ratexTypefaceLoader
|
|
18
19
|
import com.swmansion.enriched.markdown.styles.MathStyle
|
|
19
20
|
import com.swmansion.enriched.markdown.styles.StyleConfig
|
|
20
21
|
import io.ratex.RaTeXEngine
|
|
@@ -100,7 +101,8 @@ class MathContainerView(
|
|
|
100
101
|
cachedLatex = latex
|
|
101
102
|
try {
|
|
102
103
|
val displayList = RaTeXEngine.parseBlocking(latex, displayMode = true, color = mathStyle.color)
|
|
103
|
-
mathView.renderer =
|
|
104
|
+
mathView.renderer =
|
|
105
|
+
RaTeXRenderer(displayList, mathStyle.fontSize, ratexTypefaceLoader(mathStyle.fontWeight))
|
|
104
106
|
} catch (e: Exception) {
|
|
105
107
|
Log.e(TAG, "Failed to render LaTeX", e)
|
|
106
108
|
mathView.renderer = null
|
package/docs/INPUT.md
CHANGED
|
@@ -231,3 +231,7 @@ Available style properties:
|
|
|
231
231
|
- `link.underline` — whether links are underlined (defaults to `true`).
|
|
232
232
|
- `spoiler.color` — text color for spoiler text.
|
|
233
233
|
- `spoiler.backgroundColor` — background color for spoiler text.
|
|
234
|
+
- `math.fontWeight` — `'bold'` | `'normal'` (default `'normal'`); typesets inline formula chips
|
|
235
|
+
(`$...$`) at bold weight. See [LATEX_MATH.md](./LATEX_MATH.md#bold-formulas).
|
|
236
|
+
- `mathBlock.fontWeight` — same for block formula chips (`$$...$$`); inherits from
|
|
237
|
+
`math.fontWeight` when unset.
|
package/docs/LATEX_MATH.md
CHANGED
|
@@ -27,6 +27,7 @@ Einstein's mass-energy equivalence $E = mc^2$ is one of the most famous equation
|
|
|
27
27
|
},
|
|
28
28
|
inlineMath: {
|
|
29
29
|
color: '#1F2937',
|
|
30
|
+
paddingVertical: 4,
|
|
30
31
|
},
|
|
31
32
|
}}
|
|
32
33
|
/>
|
|
@@ -34,6 +35,62 @@ Einstein's mass-energy equivalence $E = mc^2$ is one of the most famous equation
|
|
|
34
35
|
|
|
35
36
|
Block math equations are rendered as standalone display elements with spacing and an optional background. Inline math inherits the surrounding block's typography.
|
|
36
37
|
|
|
38
|
+
### Spacing around inline formulas
|
|
39
|
+
|
|
40
|
+
An inline formula reports its own height, and tall constructs such as `\frac` are routinely taller than the
|
|
41
|
+
surrounding text. The block's `lineHeight` cannot loosen those lines: it is applied expand-only, so a value
|
|
42
|
+
below the formula's natural height is ignored rather than compressing the formula out of its box. Two wrapped
|
|
43
|
+
lines that each contain a fraction therefore sit flush against each other.
|
|
44
|
+
|
|
45
|
+
`inlineMath.paddingVertical` (points, default `4`) adds empty space above and below the formula box, which is
|
|
46
|
+
what pushes those lines apart. It affects only lines that actually contain inline math — prose-only lines keep
|
|
47
|
+
the line height they had. Set it to `0` to get the old flush behaviour back. Block math (`$$...$$`) has its own
|
|
48
|
+
`math.padding` instead.
|
|
49
|
+
|
|
50
|
+
### Bold formulas
|
|
51
|
+
|
|
52
|
+
`math.fontWeight` / `inlineMath.fontWeight` (`'normal'` | `'bold'`, default `'normal'`) typeset a
|
|
53
|
+
formula at bold weight. Set it wherever the surrounding text is bold so the formula follows it.
|
|
54
|
+
|
|
55
|
+
The embolden is **synthetic on every platform** — no real bold face is ever used.
|
|
56
|
+
|
|
57
|
+
On **iOS and Android** it is a stroke on the glyph outline and the platform's fake-bold
|
|
58
|
+
respectively, rather than a switch to the bundled KaTeX bold faces. That is deliberate. The native
|
|
59
|
+
engine has no weight parameter, and by the time a style applies, glyph positions are already laid
|
|
60
|
+
out: the bold faces' advances run up to 15% wider than the regular ones the layout reserved, so
|
|
61
|
+
swapping them in would make glyphs collide. Stroking and fake-bold both preserve every advance.
|
|
62
|
+
|
|
63
|
+
Two consequences worth knowing:
|
|
64
|
+
|
|
65
|
+
- Fraction bars and rules keep their own thickness, so they do not thicken with the glyphs.
|
|
66
|
+
- On iOS the stroke width also applies to the handful of decorations the engine strokes itself
|
|
67
|
+
(`\cancel`, `\textcircled`, `\corresponds`, `\imageof`). Prefer turning bold on per surface
|
|
68
|
+
rather than globally.
|
|
69
|
+
|
|
70
|
+
On **web** the prop is a plain CSS declaration on the KaTeX output — but the library renders in
|
|
71
|
+
[MathML output mode](#web) and loads no KaTeX stylesheet or fonts, so `font-weight` is resolved by
|
|
72
|
+
the browser's own math font (STIX Two Math, Latin Modern Math, Cambria Math). Most of those ship no
|
|
73
|
+
bold face, so the browser synthesizes one there too. Treat web as synthetic as well, not as a
|
|
74
|
+
reference for how heavy bold "should" look.
|
|
75
|
+
|
|
76
|
+
`EnrichedMarkdownTextInput` honours the same prop for the formula chips typed into the editor, under
|
|
77
|
+
its own style keys — `math.fontWeight` for inline chips (`$...$`) and `mathBlock.fontWeight` for
|
|
78
|
+
block chips (`$$...$$`). `mathBlock` inherits the weight from `math` when it does not set one of its
|
|
79
|
+
own, the way it already inherits `color` and the border props:
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
<EnrichedMarkdownTextInput
|
|
83
|
+
markdownStyle={{
|
|
84
|
+
math: { fontWeight: 'bold' }, // inline chips bold…
|
|
85
|
+
mathBlock: { fontWeight: 'normal' }, // …block chips opt back out
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The caveats above apply unchanged — the embolden is the same synthetic one, and the chip keeps its
|
|
91
|
+
measured width because fake-bold and stroking both preserve the glyph advances. Editor chips are
|
|
92
|
+
iOS + Android only; there is no web or macOS chip surface.
|
|
93
|
+
|
|
37
94
|
> [!IMPORTANT]
|
|
38
95
|
> 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.
|
|
39
96
|
|
|
@@ -53,6 +110,11 @@ yarn add katex
|
|
|
53
110
|
|
|
54
111
|
KaTeX is loaded lazily the first time a LaTeX node is encountered, so it has no impact on pages that do not render math. No stylesheet or `<link>` tag is needed.
|
|
55
112
|
|
|
113
|
+
If you load `katex/dist/katex.min.css` anyway — some setups do — its `.katex` rule opens with the
|
|
114
|
+
`font` shorthand, which resets `font-weight` and would drop [`fontWeight`](#bold-formulas) on the
|
|
115
|
+
way down to the formula. The library injects `.katex { font-weight: inherit; }` to keep the prop
|
|
116
|
+
working in that case; nothing is required of you.
|
|
117
|
+
|
|
56
118
|
> [!NOTE]
|
|
57
119
|
> MathML is supported natively in Chrome 109+, Firefox, and Safari. Older browsers will display the raw LaTeX source as a text fallback.
|
|
58
120
|
|
package/docs/STYLES.md
CHANGED
|
@@ -179,9 +179,12 @@ The library provides sensible default styles for all Markdown elements out of th
|
|
|
179
179
|
padding: 12,
|
|
180
180
|
marginBottom: 16,
|
|
181
181
|
textAlign: 'center',
|
|
182
|
+
fontWeight: 'normal',
|
|
182
183
|
},
|
|
183
184
|
inlineMath: {
|
|
184
185
|
color: '#1F2937',
|
|
186
|
+
paddingVertical: 4,
|
|
187
|
+
fontWeight: 'normal',
|
|
185
188
|
},
|
|
186
189
|
spoiler: {
|
|
187
190
|
color: '#6B7280',
|
|
@@ -25,7 +25,11 @@
|
|
|
25
25
|
- (void)renderForMacOS
|
|
26
26
|
{
|
|
27
27
|
RCTUIColor *color = self.mathTextColor ?: [RCTUIColor blackColor];
|
|
28
|
-
ENRMRaTeXRenderResult *result = [ENRMRaTeXBridge parse:self.latex
|
|
28
|
+
ENRMRaTeXRenderResult *result = [ENRMRaTeXBridge parse:self.latex
|
|
29
|
+
displayMode:NO
|
|
30
|
+
fontSize:self.fontSize
|
|
31
|
+
color:color
|
|
32
|
+
bold:self.bold];
|
|
29
33
|
if (!result)
|
|
30
34
|
return;
|
|
31
35
|
|
|
@@ -9,6 +9,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
9
9
|
@property (nonatomic, assign) CGFloat fontSize;
|
|
10
10
|
@property (nonatomic, strong, nullable) RCTUIColor *mathTextColor;
|
|
11
11
|
|
|
12
|
+
/// Typeset the glyphs at bold weight (synthetic — see ENRMRaTeXBridge).
|
|
13
|
+
@property (nonatomic, assign) BOOL bold;
|
|
14
|
+
|
|
12
15
|
/// YES if block math (`$$...$$`), NO for inline (`$...$`).
|
|
13
16
|
@property (nonatomic, assign) BOOL displayMode;
|
|
14
17
|
|