Update markdown to 0.33.0 and tweak visuals (#2024)

- Update markdown to 0.33.0
- Use github flavour for github changelog
- Fix bullet list alignment
This commit is contained in:
Secozzi
2025-04-19 18:13:05 +00:00
committed by GitHub
parent f6617a7a22
commit e2915a1f69
4 changed files with 25 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
- Fix user notes not restoring when manga doesn't exist in DB ([@AntsyLich](https://github.com/AntsyLich)) ([#1945](https://github.com/mihonapp/mihon/pull/1945)) - Fix user notes not restoring when manga doesn't exist in DB ([@AntsyLich](https://github.com/AntsyLich)) ([#1945](https://github.com/mihonapp/mihon/pull/1945))
- Add markdown support for manga descriptions ([@Secozzi](https://github.com/Secozzi)) ([#1948](https://github.com/mihonapp/mihon/pull/1948)) - Add markdown support for manga descriptions ([@Secozzi](https://github.com/Secozzi)) ([#1948](https://github.com/mihonapp/mihon/pull/1948))
- Use simpler markdown flavour ([@Secozzi](https://github.com/Secozzi)) ([#2000](https://github.com/mihonapp/mihon/pull/2000)) - Use simpler markdown flavour ([@Secozzi](https://github.com/Secozzi)) ([#2000](https://github.com/mihonapp/mihon/pull/2000))
- Use Github markdown flavour for Github releases & fix bullet list alignment ([@Secozzi](https://github.com/Secozzi)) ([#2024](https://github.com/mihonapp/mihon/pull/2024))
- Add Nord Theme ([@Riztard](https://github.com/Riztard)) ([#1951](https://github.com/mihonapp/mihon/pull/1951)) - Add Nord Theme ([@Riztard](https://github.com/Riztard)) ([#1951](https://github.com/mihonapp/mihon/pull/1951))
- Option to keep read manga when clearing database ([@AwkwardPeak7](https://github.com/AwkwardPeak7)) ([#1979](https://github.com/mihonapp/mihon/pull/1979)) - Option to keep read manga when clearing database ([@AwkwardPeak7](https://github.com/AwkwardPeak7)) ([#1979](https://github.com/mihonapp/mihon/pull/1979))

View File

@@ -26,7 +26,9 @@ import com.mikepenz.markdown.m3.markdownTypography
import com.mikepenz.markdown.model.MarkdownAnnotator import com.mikepenz.markdown.model.MarkdownAnnotator
import com.mikepenz.markdown.model.markdownAnnotator import com.mikepenz.markdown.model.markdownAnnotator
import com.mikepenz.markdown.model.markdownPadding import com.mikepenz.markdown.model.markdownPadding
import com.mikepenz.markdown.model.rememberMarkdownState
import org.intellij.markdown.MarkdownTokenTypes.Companion.HTML_TAG import org.intellij.markdown.MarkdownTokenTypes.Companion.HTML_TAG
import org.intellij.markdown.flavours.MarkdownFlavourDescriptor
import org.intellij.markdown.flavours.commonmark.CommonMarkFlavourDescriptor import org.intellij.markdown.flavours.commonmark.CommonMarkFlavourDescriptor
import org.intellij.markdown.flavours.commonmark.CommonMarkMarkerProcessor import org.intellij.markdown.flavours.commonmark.CommonMarkMarkerProcessor
import org.intellij.markdown.flavours.gfm.table.GitHubTableMarkerProvider import org.intellij.markdown.flavours.gfm.table.GitHubTableMarkerProvider
@@ -49,12 +51,18 @@ import tachiyomi.presentation.core.components.material.padding
fun MarkdownRender( fun MarkdownRender(
content: String, content: String,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
flavour: MarkdownFlavourDescriptor = SimpleMarkdownFlavourDescriptor,
annotator: MarkdownAnnotator = markdownAnnotator(), annotator: MarkdownAnnotator = markdownAnnotator(),
) { ) {
Markdown( val markdownState = rememberMarkdownState(
content = content, content = content,
flavour = flavour,
immediate = true,
)
Markdown(
markdownState = markdownState,
annotator = annotator, annotator = annotator,
flavour = SimpleMarkdownFlavourDescriptor,
typography = mihonMarkdownTypography(), typography = mihonMarkdownTypography(),
padding = mihonMarkdownPadding(), padding = mihonMarkdownPadding(),
components = mihonMarkdownComponents(), components = mihonMarkdownComponents(),
@@ -114,10 +122,16 @@ private fun mihonMarkdownComponents() = markdownComponents(
val markers = listOf("", "", "", "") val markers = listOf("", "", "", "")
CompositionLocalProvider( CompositionLocalProvider(
LocalBulletListHandler provides { _, _, _, _ -> "${markers[ul.listDepth % markers.size]} " }, LocalBulletListHandler provides { _, _, _, _, _ -> "${markers[ul.listDepth % markers.size]} " },
) { ) {
Column(modifier = Modifier.padding(start = MaterialTheme.padding.small)) { Column(modifier = Modifier.padding(start = MaterialTheme.padding.small)) {
MarkdownBulletList(ul.content, ul.node, style = ul.typography.bullet) MarkdownBulletList(
content = ul.content,
node = ul.node,
style = ul.typography.bullet,
markerModifier = { Modifier.alignBy(FirstBaseline) },
listModifier = { Modifier.alignBy(FirstBaseline) },
)
} }
} }
}, },

View File

@@ -17,6 +17,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewLightDark
import eu.kanade.presentation.manga.components.MarkdownRender import eu.kanade.presentation.manga.components.MarkdownRender
import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.presentation.theme.TachiyomiPreviewTheme
import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.i18n.stringResource
@@ -44,7 +45,10 @@ fun NewUpdateScreen(
.fillMaxWidth() .fillMaxWidth()
.padding(vertical = MaterialTheme.padding.large), .padding(vertical = MaterialTheme.padding.large),
) { ) {
MarkdownRender(content = changelogInfo) MarkdownRender(
content = changelogInfo,
flavour = GFMFlavourDescriptor(),
)
TextButton( TextButton(
onClick = onOpenInBrowser, onClick = onOpenInBrowser,

View File

@@ -10,7 +10,7 @@ voyager = "1.0.1"
spotless = "7.0.3" spotless = "7.0.3"
ktlint-core = "1.5.0" ktlint-core = "1.5.0"
firebase-bom = "33.11.0" firebase-bom = "33.11.0"
markdown = "0.33.0-rc01" markdown = "0.33.0"
[libraries] [libraries]
desugar = "com.android.tools:desugar_jdk_libs:2.1.5" desugar = "com.android.tools:desugar_jdk_libs:2.1.5"