Skip to content

Split markdown into blocks so that checkboxes are singled out #215

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

Conversation

newhinton
Copy link
Contributor

@newhinton newhinton commented Oct 2, 2023

This will seperate the markdown into different RemoteViewElements.

Each RemoteViewElement has a type and a text. The text corresponds to the raw, unrendered markdown, and the type will allow the result to be used more precisely.

I did this, so that i could implement checkboxes:

image

I develop this library-extension in tandem with the actual widget. So while this is not really a draft, i would not merge this yet until i got the actual feature to be reviewed on the app-side.

See: nextcloud/notes-android#1912

Copy link
Owner

@stefan-niedermann stefan-niedermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please use Java only in this library. There are good reasons to use Kotlin, but this library module is Java only and I do not want to mix it up.
  2. Please add at least one unit test for your method, better a few more with some edge cases (null or empty content parameter)-

import java.util.ArrayList

class RemoteViewElement(
val type: Int,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an Enum

@@ -159,14 +226,21 @@ private static String runForEachCheckbox(@NonNull String markdownString, @NonNul
}
}
if (!isInFencedCodeBlock) {
if (lineStartsWithCheckbox(lines[i]) && lines[i].trim().length() > EListType.DASH.checkboxChecked.length()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why I used to only consider EListType.DASH... This should maybe refactored to loop through the EListType enum.... however, nothing you will have to fix here :)

@stefan-niedermann
Copy link
Owner

Merged in #245 (I also fixed the review items I made)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants