Skip to content
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

Tables control does not display numbers exceeding 5 digits #224

Closed
zhouzhuo810 opened this issue Mar 28, 2020 · 13 comments
Closed

Tables control does not display numbers exceeding 5 digits #224

zhouzhuo810 opened this issue Mar 28, 2020 · 13 comments
Labels

Comments

@zhouzhuo810
Copy link

zhouzhuo810 commented Mar 28, 2020

  • Markwon version: 4.3.0
  1. Please specify expected/actual behavior

A bit strange, on my OPPO Reno ACE phone, the numbers in the table are not displayed when they exceed 5 digits. But it shows on my Xiaomi 6 phone.

  1. Please specify conditions/steps to reproduce (layout, code, markdown used, etc)

gradle

    implementation "io.noties.markwon:core:4.3.0"
    implementation "io.noties.markwon:image:4.3.0"
    implementation "io.noties.markwon:ext-latex:4.3.0"
    implementation 'io.noties.markwon:ext-strikethrough:4.3.0'
    implementation 'io.noties.markwon:inline-parser:4.3.0'
    implementation 'io.noties.markwon:image-picasso:4.3.0'
    implementation 'io.noties.markwon:ext-tables:4.3.0'
    implementation 'io.noties.markwon:linkify:4.3.0'
    implementation('io.noties.markwon:syntax-highlight:4.3.0') {
        exclude group: 'org.jetbrains'
    }
    implementation 'io.noties.markwon:ext-tasklist:4.3.0'
    implementation 'io.noties.markwon:html:4.3.0'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
    implementation("io.noties:prism4j:2.0.0") {
        exclude group: 'org.jetbrains'
    }
    annotationProcessor 'io.noties:prism4j-bundler:2.0.0'
    implementation 'com.caverock:androidsvg-aar:1.4'

layout

        <ScrollView
            android:id="@+id/scroll_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="20dp"
            android:overScrollMode="never"
            android:scrollbars="none"
            >

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/tv_markdown"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:lineSpacingExtra="6dp"
                android:textSize="16sp" />

        </ScrollView>

init

    mMarkwon = Markwon
            .builder(this)
            .usePlugin(StrikethroughPlugin.create())
            .usePlugin(LinkifyPlugin.create())
            .usePlugin(TaskListPlugin.create(DetailMarkdownPlusActivity.this))
            .usePlugin(SyntaxHighlightPlugin.create(new Prism4j(new MyGrammarLocator()), isNightMode() ? Prism4jThemeDarkula.create()
                : Prism4jThemeDefault.create()))
            .usePlugin(HtmlPlugin.create(new HtmlPlugin.HtmlConfigure() {
                @Override
                public void configureHtml(@NonNull HtmlPlugin plugin) {
                    plugin.addHandler(new AlignTagHandler());
                }
            }))
            .usePlugin(TablePlugin.create(new TablePlugin.ThemeConfigure() {
                @Override
                public void configureTheme(@NonNull TableTheme.Builder builder) {
                    boolean nightMode = isNightMode();
                    builder
                        .tableBorderWidth(1)
                        .tableEvenRowBackgroundColor(Color.parseColor(nightMode ? "#4Dcccccc" : "#4D9EBCE2"))
                        .tableOddRowBackgroundColor(Color.parseColor(nightMode ? "#2Dcccccc" : "#2D9EBCE2"))
                        .tableCellPadding(DisplayUtils.dip2px(4));
                }
            }))
            .usePlugin(ImagesPlugin.create(new ImagesPlugin.ImagesConfigure() {
                @Override
                public void configureImages(@NonNull ImagesPlugin plugin) {
                    plugin.addSchemeHandler(FileSchemeHandler.create());
                    plugin.addSchemeHandler(OkHttpNetworkSchemeHandler.create());
                }
            }))
            .usePlugin(PicassoImagesPlugin.create(Picasso.get()))
            .usePlugin(new AbstractMarkwonPlugin() {
                @Override
                public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) {
                    super.beforeSetText(textView, markdown);
                    AsyncDrawableScheduler.unschedule(textView);
                }
                
                @Override
                public void afterSetText(@NonNull TextView textView) {
                    super.afterSetText(textView);
                    AsyncDrawableScheduler.schedule(textView);
                }
            })
            .usePlugin(MarkwonInlineParserPlugin.create())
            .usePlugin(JLatexMathPlugin.create(mEtMarkdown.getTextSize(), new JLatexMathPlugin.BuilderConfigure() {
                @Override
                public void configureBuilder(@NonNull JLatexMathPlugin.Builder builder) {
                    builder.inlinesEnabled(true);
                }
            }))
            .build();

usage

        Observable.just(content)
            .map(new Function<String, Spanned>() {
                @Override
                public Spanned apply(String s) throws Exception {
                    return mMarkwon.toMarkdown(s);
                }
            })
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(DetailMarkdownPlusActivity.this)))
            .subscribe(new Consumer<Spanned>() {
                @Override
                public void accept(Spanned str) throws Exception {
                    if (mMarkwon != null && mTvMarkdown != null && str != null) {
                        mMarkwon.setParsedMarkdown(mTvMarkdown, str);
                    }
                }
            }, Throwable :: printStackTrace);

when > 4 digits

before

Screenshot_2020-03-28-13-44-56-46_6db4d030f3e82ab

after

IMG_20200328_134510

when <= 4 digits

Screenshot_2020-03-28-14-17-59-13_6db4d030f3e82ab

others

  1. I tried removing the margin of the ScrollView, but it didn't work.
  2. I tried removing the cell padding of the Table Plugin, but it didn't work.

so i have no idea how to solve this problem. can you help me ?

@noties
Copy link
Owner

noties commented Mar 28, 2020

Hello @zhouzhuo810 !

It's weird, but I think it has nothing to do with the digits. Can you share you raw markdown input for me to copy paste?

@zhouzhuo810
Copy link
Author

zhouzhuo810 commented Mar 28, 2020

| HEADER | HEADER | HEADER |
|:----:|:----:|:----:|
|   测试  |   测试   |   测试   |
|  测试  |   测试   |  测试   |
|   测试  |   测试   |   123445   |

测试

That's all @noties

@noties
Copy link
Owner

noties commented Mar 28, 2020

@zhouzhuo810 can you try with Chinese characters (some long sequence) instead of digits? For me it's correctly overflowing making text multiline

@zhouzhuo810
Copy link
Author

@noties Chinese display is fine,If the number is included and the length is 5, the number disappears.

| HEADER | HEADER | HEADER |
|:----:|:----:|:----:|
|   测试  |   测试   |   测试   |
|  测试  |   测试   |  测测试测123456试测试测试   |
|   测试  |   测试   |   123445   |

测试

preview:

Screenshot_2020-03-28-19-30-44-41_6db4d030f3e82ab

@noties
Copy link
Owner

noties commented Mar 28, 2020

This is really weird, are you using any custom font? As a crazy idea, can you try digits without the 4?

@zhouzhuo810
Copy link
Author

zhouzhuo810 commented Mar 28, 2020

@noties haha,I'm not using any custom font, but even more strangely, the same phone can be displayed using the Pure Writer APP. I don't know how Pure Writer uses markwon.

| HEADER | HEADER | HEADER |
|:----:|:----:|:----:|
|   测试  |   测试   |   测试   |
|  测试  |   测试   |  测测试测1234试测试测试   |
|   测试  |   测试   |   123445   |

测试

preview:

Screenshot_2020-03-28-19-47-54-25_6db4d030f3e82ab

Pure Writer preview:

Screenshot_2020-03-28-19-55-16-64_fb32c6d94298da1

@noties
Copy link
Owner

noties commented Mar 28, 2020

Can you try to render this markdown with high contrast text option enabled? It seems that digits are there but by some strange reason are not displayed

@noties
Copy link
Owner

noties commented Mar 28, 2020

Also, please try without linkify plugin, I think this is the culprit

UPD: can you also add a link somewhere in your markdown outside the table, like [测试](#)? Will it rendered/styled as a link?

@zhouzhuo810
Copy link
Author

@noties ok

| HEADER | HEADER | HEADER |
|:----:|:----:|:----:|
|   测试  |   测试   |   测试   |
|  测试  |   测试   |  测测测12345试测试测试   |
|   测试  |   测试   |   123445   |

测试

[https://www.baidu.com](https://www.baidu.com)

preview:

Screenshot_2020-03-28-21-11-43-01_6db4d030f3e82ab

I will try without linkify, please wait for my reply.

@zhouzhuo810
Copy link
Author

@noties Wow, that's it. Thank you very much !

Screenshot_2020-03-28-21-17-45-59_6db4d030f3e82ab

@noties
Copy link
Owner

noties commented Mar 28, 2020

Glad I could help @zhouzhuo810 🙌 !

Still I would like to keep this issue open until I investigate why tables are not displaying linkified content

@noties noties reopened this Mar 28, 2020
@zhouzhuo810
Copy link
Author

OK ~ 🙌

@noties noties added the bug label Mar 29, 2020
@noties
Copy link
Owner

noties commented Mar 29, 2020

It is actually a bug in ext-tables because of which links are not displayed properly

@noties noties mentioned this issue Apr 1, 2020
@noties noties closed this as completed Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants