Remove AndDown code

This commit is contained in:
William Brawner 2024-01-29 21:09:45 -07:00
parent 32b4518bf7
commit b706f5b5eb
2 changed files with 1 additions and 13 deletions

View file

@ -11,7 +11,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.navigation.NavController
import com.wbrawner.simplemarkdown.utility.readAssetToString
import com.wbrawner.simplemarkdown.utility.toHtml
@Composable
fun MarkdownInfoScreen(
@ -30,7 +29,7 @@ fun MarkdownInfoScreen(
val context = LocalContext.current
val (markdown, setMarkdown) = remember { mutableStateOf("") }
LaunchedEffect(file) {
setMarkdown(context.assets.readAssetToString(file)?.toHtml() ?: "Failed to load $file")
setMarkdown(context.assets.readAssetToString(file) ?: "Failed to load $file")
}
MarkdownPreview(
modifier = Modifier

View file

@ -6,7 +6,6 @@ import android.net.Uri
import android.provider.OpenableColumns
import android.view.View
import android.view.inputmethod.InputMethodManager
import com.commonsware.cwac.anddown.AndDown
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.io.Reader
@ -27,16 +26,6 @@ suspend fun AssetManager.readAssetToString(asset: String): String? {
}
}
const val HOEDOWN_FLAGS = AndDown.HOEDOWN_EXT_STRIKETHROUGH or AndDown.HOEDOWN_EXT_TABLES or
AndDown.HOEDOWN_EXT_UNDERLINE or AndDown.HOEDOWN_EXT_SUPERSCRIPT or
AndDown.HOEDOWN_EXT_FENCED_CODE
suspend fun String.toHtml(): String {
return withContext(Dispatchers.IO) {
AndDown().markdownToHtml(this@toHtml, HOEDOWN_FLAGS, 0)
}
}
suspend fun Uri.getName(context: Context): String {
var fileName: String? = null
try {