File tree Expand file tree Collapse file tree
android-sample/src/main/java/com/zachklipp/richtext/sample
richtext-markdown/src/commonMain/kotlin/com/halilibo/richtext/markdown Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,7 +102,6 @@ private fun TableBehaviorPreview() {
102102 BehaviorSection (
103103 title = " Markdown table renders with RTL compatibility enabled" ,
104104 markdown = tableMarkdown,
105- richTextRenderOptions = RichTextRenderOptions (enableRtlCompatibility = true ),
106105 )
107106 }
108107 }
@@ -139,7 +138,7 @@ private fun BehaviorPreviewColumn(
139138private fun BehaviorSection (
140139 title : String ,
141140 markdown : String ,
142- richTextRenderOptions : RichTextRenderOptions = RichTextRenderOptions () ,
141+ richTextRenderOptions : RichTextRenderOptions = rtlCompatibilityOptions ,
143142) {
144143 Column (
145144 modifier = Modifier .fillMaxWidth(),
@@ -169,6 +168,8 @@ private fun BehaviorMarkdown(
169168 }
170169}
171170
171+ private val rtlCompatibilityOptions = RichTextRenderOptions (enableRtlCompatibility = true )
172+
172173private val englishStartingQuoteMarkdown = """
173174 > English opens this quote.
174175 > אחר כך מופיעה עברית.
Original file line number Diff line number Diff line change @@ -117,12 +117,14 @@ private fun MarkdownCaseContent(
117117 RichText (modifier = Modifier .fillMaxWidth()) {
118118 Markdown (
119119 content = markdown,
120- richtextRenderOptions = RichTextRenderOptions () ,
120+ richtextRenderOptions = rtlCompatibilityOptions ,
121121 )
122122 }
123123 }
124124}
125125
126+ private val rtlCompatibilityOptions = RichTextRenderOptions (enableRtlCompatibility = true )
127+
126128private data class PreviewVariant (
127129 val localeLabel : String ,
128130 val layoutDirection : LayoutDirection ,
Original file line number Diff line number Diff line change @@ -412,11 +412,15 @@ private val DefaultAstNodeComposer = object : AstBlockNodeComposer {
412412 }
413413
414414 is AstHtmlBlock -> {
415- Text (text = richTextString {
416- appendInlineContent(content = InlineContent {
417- HtmlBlock (astNodeType.literal)
415+ if (richTextRenderOptions.enableRtlCompatibility) {
416+ HtmlBlock (astNodeType.literal)
417+ } else {
418+ Text (text = richTextString {
419+ appendInlineContent(content = InlineContent {
420+ HtmlBlock (astNodeType.literal)
421+ })
418422 })
419- })
423+ }
420424 }
421425
422426 is AstLinkReferenceDefinition -> {
Original file line number Diff line number Diff line change @@ -97,8 +97,7 @@ internal fun RichTextScope.MarkdownRichText(
9797 renderOptions = richTextRenderOptions,
9898 sharedAnimationState = markdownAnimationState,
9999 decorations = richTextDecorations,
100- textAlign = LocalCompatibilityTextAlignOverride .current
101- ? : compatibilityDirection.toCompatibilityTextAlign(),
100+ textAlign = LocalCompatibilityTextAlignOverride .current,
102101 textDirection = textDirection,
103102 )
104103}
You can’t perform that action at this time.
0 commit comments