-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to remove underline for url link #193
Comments
Hello @crossle ! There are at least 2 options:
Anyway you start by creating a new plugin: final Markwon markwon = Markwon.builder(context)
.usePlugin(new AbstractMarkwonPlugin() {
@Override
public void configureSpansFactory(@NonNull MarkwonSpansFactory.Builder builder) {
final SpanFactory original = builder.getFactory(Link.class);
if (original != null) {
builder.setFactory(Link.class, (configuration, props) -> {
// reversed order
return new Object[] {
new RemoveUnderlineSpan(),
original.getSpans(configuration, props)
};
});
}
// or, you can provide own implementation for LinkSpan by calling:
// builder.setFactory(Link.class, new SpanFactory() {
// @Nullable
// @Override
// public Object getSpans(@NonNull MarkwonConfiguration configuration, @NonNull RenderProps props) {
// TODO()
// }
// });
}
})
.build(); Please note that the first option needs to return spans in reversed order (added first will be processed last) public class RemoveUnderlineSpan extends CharacterStyle implements UpdateAppearance {
@Override
public void updateDrawState(TextPaint tp) {
tp.setUnderlineText(false);
}
} |
Coool, got it. Thanks |
UPD: in
So, taking into consideration these additions, code could be rewritten as: builder.appendFactory(Link.class, (configuration, props) -> new RemoveUnderlineSpan()); |
@noties BTW, RecyclerView does not support GitHub task list format ? |
@crossle Markwon supports task lists via |
@noties OK, thanks. |
@noties Other question, How to support text selection in RecyclerView? I add markdown item TextView add |
@crossle can you please explain the |
@crossle the problem might be with the // for example in `onCreateHolder`, so this is done once per `TextView`
holder.textView.setMovementMethod(LinkMovementMethod.getInstance());
// then in `onBind` apply your markdown as usual:
markwon.setMarkdown(holder.textView, markdown); |
How to set on recyclerview? |
You don't set it on RecyclerView, you set it on the TextView with markdown content inside RecyclerView |
The link style always have underline, how to remove the underline for the link?
The text was updated successfully, but these errors were encountered: