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

BUG: Checkbox UL (list) markdown parsing is broken. If a normal UL is below or above a Checkbox UL, BOTH are rendered erronously as a Checkbox UL. #11059

Open
futuremotiondev opened this issue Sep 16, 2024 · 3 comments · May be fixed by #11060
Labels
bug It's a bug

Comments

@futuremotiondev
Copy link

Operating system

Windows

Joplin version

3.1.8 (prod, win32)

Desktop version info

Joplin 3.1.8 (prod, win32)

Client ID: 1bb78c52da5b4fe090823a3b13953af6
Sync Version: 3
Profile Version: 47
Keychain Supported: Yes

Revision: 55faab2

Backup: 1.4.2
Csv Import: 1.0.1
Favorites: 1.3.2
Headings 4 to 6: 1.0.1
Insert Date: 1.0.1
Paste Special: 1.1.2
Table Formatter Plugin: 1.2.1

Current behaviour

  1. Create the following markup:
## Lorem ipsum dolor sit amet

- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
- Ut fringilla neque efficitur imperdiet luctus.
- Donec id magna ac nisi iaculis gravida sit amet non orci.
- Praesent semper massa vel elit dapibus mollis.
- Proin sit amet massa mollis, convallis ipsum et, vulputate metus.

- [ ] Lorem ipsum dolor sit amet, consectetur adipiscing elit.
- [ ] Ut fringilla neque efficitur imperdiet luctus.
- [ ] Donec id magna ac nisi iaculis gravida sit amet non orci.
- [ ] Praesent semper massa vel elit dapibus mollis.
- [ ] Proin sit amet massa mollis, convallis ipsum et, vulputate metus.
  1. Switch to RTE mode.
  2. Observe that both lists are rendered as checkbox lists:

Joplin_LqBiyZdAy9

Also if inspected with devtools, you can see that Joplin is treating them both as a single checkbox list:

Joplin_DZFnLuRDWf

Expected behaviour

I expected Joplin to render the normal UL section with discs, and the checkbox UL section with check-boxes.

I have attached a zipped jex file that demonstrates the bug:

Broken List Rendering.zip

This is a fairly big rendering and parsing error, hopefully you can reproduce and fix. If you need any help with reproducing the bug I am here and will do my best.

Logs

No response

@futuremotiondev futuremotiondev added the bug It's a bug label Sep 16, 2024
@futuremotiondev
Copy link
Author

Also, a followup. If you insert an HR between the lists like so:

## Lorem ipsum dolor sit amet

- [ ] Lorem ipsum dolor sit amet, consectetur adipiscing elit.
- [ ] Ut fringilla neque efficitur imperdiet luctus.
- [ ] Donec id magna ac nisi iaculis gravida sit amet non orci.
- [ ] Praesent semper massa vel elit dapibus mollis.
- [ ] Proin sit amet massa mollis, convallis ipsum et, vulputate metus.

---

- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
- Ut fringilla neque efficitur imperdiet luctus.
- Donec id magna ac nisi iaculis gravida sit amet non orci.
- Praesent semper massa vel elit dapibus mollis.
- Proin sit amet massa mollis, convallis ipsum et, vulputate metus.

It renders correctly:

Joplin_azMZrcLs2Z

@tomasz1986
Copy link

This is a known limitation of Joplin (see #6423 (comment)).

nirzaf added a commit to nirzaf/joplin that referenced this issue Sep 16, 2024
Fixes laurent22#11059

Fix the markdown parser to correctly render normal UL and Checkbox UL separately.

* **Assets/TinyMCE/JoplinLists/src/main/ts/core/NormalizeLists.ts**
  - Add `isCheckboxList` function to check if a list is a checkbox list.
  - Modify `normalizeLists` to handle checkbox lists separately.

* **Assets/TinyMCE/JoplinLists/src/main/ts/listModel/JoplinListUtil.ts**
  - Correct typo in `findContainerListTypeFromElement` function.
  - Ensure `findContainerListTypeFromElement` correctly identifies checkbox lists.

* **Assets/TinyMCE/JoplinLists/src/main/ts/listModel/ParseLists.ts**
  - Import `isCheckboxListItem` from `JoplinListUtil`.
  - Update `parseLists` to handle checkbox lists separately and set the correct list type.
@nirzaf nirzaf linked a pull request Sep 16, 2024 that will close this issue
@futuremotiondev
Copy link
Author

Looks like nirzaf just submitted a PR fixing this... awesome! Hopefully it gets merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants