zulip-flutter
zulip-flutter copied to clipboard
Handle `<ol start=…>`
An <ol> element in Zulip HTML can have the start attribute, like so:
<ol start="9999">
<li>Fjfjdj</li>
<li>Fjdjdj</li>
</ol>
On Zulip web, this renders like so:

(The fact that the numbers are cut off at the left is a bug that's getting fixed: https://github.com/zulip/zulip/pull/25063.)
Currently we ignore start and always start the numbering at 1. We should instead respect start when we see it.
This means:
- When we parse the HTML,
ListNodeshould get a bit more information to recordstart. Possibly make it abstract and give it subclassesOrderedListNodeandUnorderedListNode, sincestartwon't make sense on the latter. - Then
ListNodeWidgetshould act on that information.
The Zulip Markdown message source that produces the example HTML above is:
9999. Fjfjdj
10000. Fjdjdj
As part of this issue, the changes to HTML parsing should get tests in test/model/content_test.dart. ~~This will probably involve adding another case to ContentNodeChecks.equalsNode (in content_checks.dart) for ListNode, similar to the existing case for ParagraphNode.~~
Ideally the changes to ListNodeWidget should also get tests, in test/widgets/content_test.dart. ~~But we don't yet really have an example of that kind of test, so it's OK to leave that out for this issue.~~ We have fewer examples of these, and I think that's a lower-priority test for this code (because that part seems less likely to later get broken by accident), so if that test feels hard to write then it's OK to leave it out for this issue.
(Edited 2023-07-10 with updates.)
Hi, Greg.
I do not know all details of the environment for this task. That's why I have done it as simple utils extensions for html document and element. As you can see, I have done the code and cover it by tests.
Please, see the result here:
https://github.com/chplalex/zulip_59
I would like feedback from you.
A little later I will look at your second task
Have a nice weekend!
Thanks @chplalex!
I think a separate standalone piece of code like that won't be very helpful for us, though. What this issue is about is to add this feature in the context of our existing codebase.
That does mean that in order to work on it you'll need to set up the development environment. For instructions, see our README. If you have any questions about that setup or run into any trouble, please ask in #mobile-team on chat.zulip.org and we'll be glad to help.
Then once you have your hands on our code, the thread above has some details on the specific parts of our code that will be involved in adding this feature.
This was reported as a bug in beta feedback: https://chat.zulip.org/#narrow/channel/48-mobile/topic/numbered.20lists.20rendering.20wrong/near/2018415
Hi, I have started working on this issue. Sharing the screenshots shortly. Thanks!
Hi, I have raised PR #1329 for this issue, PTAL. Thanks!