question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Style Spans not applied in editor

See original GitHub issue
  • Markwon version: 4.3.1
  1. As per the demo & instructions, I wrote down code to listen for TextChange and apply the markdown style.
  2. Even though the asterisk char’s color changed, the bold did not get applied.

Here are my dependencies,

    implementation "io.noties.markwon:core:$markwon_version"
    implementation "io.noties.markwon:editor:$markwon_version"
    implementation "io.noties.markwon:ext-strikethrough:$markwon_version"
    implementation "io.noties.markwon:ext-tables:$markwon_version"
    implementation "io.noties.markwon:ext-tasklist:$markwon_version"
    implementation "io.noties.markwon:html:$markwon_version"
    implementation "io.noties.markwon:image:$markwon_version"
    implementation "io.noties.markwon:image-glide:$markwon_version"
    implementation "io.noties.markwon:linkify:$markwon_version"
    implementation "io.noties.markwon:simple-ext:$markwon_version"
    implementation "io.noties.markwon:inline-parser:$markwon_version"

layout XML,

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <androidx.appcompat.widget.AppCompatEditText
        android:id="@+id/editor"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:autofillHints="none"
        android:gravity="start|top"
        android:inputType="text|textLongMessage|textMultiLine" />

</RelativeLayout>
Screenshot_20200411-171626

Am I doing something wrong…

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
notiescommented, Apr 14, 2020

Hello @shivakumars !

This actually is a bug. I’ve looked at it briefly and it seems to be caused by a single new-line in markdown to be treated as a space. Text diffing fails (it considers **\n** to be replaced with a ) and thus second span receives wrong position. This can be solved with markdown treating soft breaks as new lines. For example:

final Markwon markwon = Markwon.builder(this)
        /* your other plugins */
        .usePlugin(SoftBreakAddsNewLinePlugin.create())
        .build();

Of cause this would mean that in display/preview mode this markdown should also treat soft breaks as new lines, otherwise content will be different

1reaction
notiescommented, Apr 12, 2020

Please refer to the documentation of how to additionally add styling whilst editing

Read more comments on GitHub >

github_iconTop Results From Across the Web

CKEditor not correctly apply span tags - Stack Overflow
CKEditor not correctly apply span tags ... I use CKEditor 4 and have this problem: This occurs when the web page opened and...
Read more >
Editor - Styles - Apply styles to elment instead of span - Telerik
I've got a Kendo editor with custom CSS styles that I'm importing via a custom style sheet. Is there a way to apply...
Read more >
Span HTML – How to Use the Span Tag with CSS
You can use the HTML span tag as a container to group inline elements together so you can style or manipulate them with...
Read more >
Applying inline styles with <span> tags with same selection ...
When applying multiple inline styles to the same text, only one span tag should be added with all the inline styles Actual behavior....
Read more >
Html Editor adds span tag with line height - Sitefinity
Hey Conrad, I recently ran into that aswell, it's because you have line-height mis-match somewhere in your regular css compared to the selected ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found