Skip to content

MarkdownTextBlock: Rewrite lists to be text-based #684

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jcoc611-microsoft
Copy link

Before, Lists were implemented using InlineUIContainer and grid layouts. This looks great, but breaks selection and accessibility. This PR rewrites lists all-up to use a combination of Paragraph, the list bullet character (either a "dot" or the index number/alpha/roman), and smart use of margins and indents.

WinUIRenderer keeps track of lists in a stack fashion, and MyParagraph uses the info from the renderer to offset the text and prepend the bullet character(s).

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

I love the idea of translating lists into text instead of custom UI, makes a lot of sense and resolves a lot of issues with accessibility and copying.

Seeing how this works, I think the crux of the issue is that a List is contained in a Paragraph and we need to modify the properties of the parent paragraph to make this work/look good.

I'm wondering if we can be better here about using parsing to detect this or having the List Renderer make/be a paragraph vs. having to connect state between the paragraph and lists between the renderer. @nerocui any insights here?

I'd have to look at the parsing tree here (I wrote a tool for that actually a few weekends back, but still need to publish it.) Like I just wonder if in all cases a list is just encapsulated by a paragraph and any text before/after is a separate paragraph. If so, we should just make a dedicated "BulletedParagraph" type which will just output the final result that he Listrenderer does vs. it being a thing which needs to coordinate with the general paragraph.

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

Successfully merging this pull request may close these issues.

3 participants