Skip to content

Commit

Permalink
新增 更新日志支持Markdown渲染。
Browse files Browse the repository at this point in the history
Added support for Markdown rendering in the update log.
  • Loading branch information
Winnie0408 committed Jan 23, 2024
1 parent 4374b08 commit ffe3d5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ dependencies {
//OkHttp3
implementation("com.squareup.okhttp3:okhttp:4.12.0")

//Markdown渲染器
implementation("com.github.jeziellago:compose-markdown:0.3.7") //TODO 使用高于此版本会出现问题,已提Issue。

//Jsoup-可注释
// implementation("org.jsoup:jsoup:1.17.2")

Expand Down
15 changes: 10 additions & 5 deletions app/src/main/java/com/hwinzniej/musichelper/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.runtime.Composable
Expand All @@ -47,7 +46,9 @@ import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.view.WindowCompat
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
Expand Down Expand Up @@ -77,6 +78,7 @@ import com.moriafly.salt.ui.UnstableSaltApi
import com.moriafly.salt.ui.darkSaltColors
import com.moriafly.salt.ui.lightSaltColors
import com.moriafly.salt.ui.saltColorsByColorScheme
import dev.jeziellago.compose.markdowntext.MarkdownText
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -323,10 +325,13 @@ private fun Pages(
.clip(RoundedCornerShape(10.dp))
) {
item {
Text(
modifier = Modifier.padding(top = 4.dp),
text = latestDescription.value,
color = SaltTheme.colors.text
MarkdownText(
modifier = Modifier.padding(vertical = 8.dp),
markdown = latestDescription.value,
style = TextStyle(
color = SaltTheme.colors.text,
fontSize = 14.sp
)
)
}
}
Expand Down

0 comments on commit ffe3d5d

Please sign in to comment.