Fix MD issues
This commit is contained in:
parent
76f8f49cdf
commit
23d6b2d8b3
|
@ -10,7 +10,6 @@ import android.text.Spanned;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||||
|
@ -232,42 +231,25 @@ public class Markdown {
|
||||||
public void configureTheme(
|
public void configureTheme(
|
||||||
@NonNull MarkwonTheme.Builder builder) {
|
@NonNull MarkwonTheme.Builder builder) {
|
||||||
|
|
||||||
builder.codeBlockTypeface(
|
|
||||||
Typeface.createFromAsset(
|
|
||||||
context.getAssets(),
|
|
||||||
"fonts/sourcecodeproregular.ttf"));
|
|
||||||
builder.codeBlockMargin(
|
builder.codeBlockMargin(
|
||||||
(int)
|
(int)
|
||||||
(context.getResources()
|
(context.getResources()
|
||||||
.getDisplayMetrics()
|
.getDisplayMetrics()
|
||||||
.density
|
.density
|
||||||
* 10));
|
* 10));
|
||||||
builder.blockMargin(
|
|
||||||
(int)
|
|
||||||
(context.getResources()
|
|
||||||
.getDisplayMetrics()
|
|
||||||
.density
|
|
||||||
* 10));
|
|
||||||
builder.codeTextSize(
|
builder.codeTextSize(
|
||||||
(int)
|
(int)
|
||||||
(context.getResources()
|
(context.getResources()
|
||||||
.getDisplayMetrics()
|
.getDisplayMetrics()
|
||||||
.scaledDensity
|
.scaledDensity
|
||||||
* 13));
|
* 13));
|
||||||
builder.codeTypeface(
|
|
||||||
Typeface.createFromAsset(
|
|
||||||
context.getAssets(),
|
|
||||||
"fonts/sourcecodeproregular.ttf"));
|
|
||||||
builder.linkColor(
|
|
||||||
ResourcesCompat.getColor(
|
|
||||||
context.getResources(),
|
|
||||||
R.color.lightBlue,
|
|
||||||
null));
|
|
||||||
|
|
||||||
if (tf == null) {
|
if (tf == null) {
|
||||||
tf = AppUtil.getTypeface(context);
|
tf = AppUtil.getTypeface(context);
|
||||||
}
|
}
|
||||||
builder.headingTypeface(tf);
|
builder.headingTypeface(
|
||||||
|
Typeface.create(tf, Typeface.BOLD));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -348,7 +330,7 @@ public class Markdown {
|
||||||
Markwon.builder(context)
|
Markwon.builder(context)
|
||||||
.usePlugin(CorePlugin.create())
|
.usePlugin(CorePlugin.create())
|
||||||
.usePlugin(HtmlPlugin.create())
|
.usePlugin(HtmlPlugin.create())
|
||||||
.usePlugin(LinkifyPlugin.create(true)) // TODO not working
|
.usePlugin(LinkifyPlugin.create(true))
|
||||||
.usePlugin(SoftBreakAddsNewLinePlugin.create())
|
.usePlugin(SoftBreakAddsNewLinePlugin.create())
|
||||||
.usePlugin(TableEntryPlugin.create(context))
|
.usePlugin(TableEntryPlugin.create(context))
|
||||||
.usePlugin(
|
.usePlugin(
|
||||||
|
@ -408,37 +390,19 @@ public class Markdown {
|
||||||
public void configureTheme(
|
public void configureTheme(
|
||||||
@NonNull MarkwonTheme.Builder builder) {
|
@NonNull MarkwonTheme.Builder builder) {
|
||||||
|
|
||||||
builder.codeBlockTypeface(
|
|
||||||
Typeface.createFromAsset(
|
|
||||||
context.getAssets(),
|
|
||||||
"fonts/sourcecodeproregular.ttf"));
|
|
||||||
builder.codeBlockMargin(
|
builder.codeBlockMargin(
|
||||||
(int)
|
(int)
|
||||||
(context.getResources()
|
(context.getResources()
|
||||||
.getDisplayMetrics()
|
.getDisplayMetrics()
|
||||||
.density
|
.density
|
||||||
* 10));
|
* 10));
|
||||||
builder.blockMargin(
|
|
||||||
(int)
|
|
||||||
(context.getResources()
|
|
||||||
.getDisplayMetrics()
|
|
||||||
.density
|
|
||||||
* 10));
|
|
||||||
builder.codeTextSize(
|
builder.codeTextSize(
|
||||||
(int)
|
(int)
|
||||||
(context.getResources()
|
(context.getResources()
|
||||||
.getDisplayMetrics()
|
.getDisplayMetrics()
|
||||||
.scaledDensity
|
.scaledDensity
|
||||||
* 13));
|
* 13));
|
||||||
builder.codeTypeface(
|
|
||||||
Typeface.createFromAsset(
|
|
||||||
context.getAssets(),
|
|
||||||
"fonts/sourcecodeproregular.ttf"));
|
|
||||||
builder.linkColor(
|
|
||||||
ResourcesCompat.getColor(
|
|
||||||
context.getResources(),
|
|
||||||
R.color.lightBlue,
|
|
||||||
null));
|
|
||||||
|
|
||||||
if (tf == null) {
|
if (tf == null) {
|
||||||
tf = AppUtil.getTypeface(context);
|
tf = AppUtil.getTypeface(context);
|
||||||
|
|
Loading…
Reference in New Issue