Skip to content

List Marker Styling v2 - #265

Open
AyUsH18102001 wants to merge 16 commits into
onizet:devfrom
AyUsH18102001:task/ahi/252/list-marker-styling-v2
Open

AyUsH18102001 wants to merge 16 commits into
onizet:devfrom
AyUsH18102001:task/ahi/252/list-marker-styling-v2

Conversation

@AyUsH18102001

Copy link
Copy Markdown
Contributor

Copy of PR #262 following the latest changes by author for Issue #252

Problem Statement

List parsing skips the styling of the marker element

Example

<ol style="color: red; font-size: 28px; font-family: system-ui">
    <li><b><em>One</em></b></li>
    <li style="color: green; font-size: 16px; font-family: Impact;">Two</li>
    <li style="color: blue; font-size: 20px; font-family: Algerian;">Three</li>
</ol>

The above list is when parsed the styles are just subjected to the Li nodes paragraphs and not to the marker, which is not the case in HTML preview

Output

image

@AyUsH18102001

Copy link
Copy Markdown
Contributor Author

Hello @onizet

Please review the change in ParsingContext factory method invocation in ListExpression, I decided to pass styleScoped to false, for this usecase we must not only stop the inheritance of a li element to its parent ol/ul element, but it can also be influecned by its parent li element i.e.

<ol style='color: red; font-size: 16px;'>
    <li>One</li>
    <li style='color: green;'>Two</li>
    <li style='color: blue;'>Three </li>
    <li style="list-style-type: none; color: magenta;">
        <ol start="4">
            <li>Four</li>
            <li style='color: purple;'>Five</li>
        </ol>
    </li>
</ol>

@onizet

onizet commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Hi @AyUsH18102001, I'm not fan that you duplicate all the styles in this container expression. This just increase the technical debt and make future maintenance more complicated as there are now 2 locations to look for basic styling such as bold.
For instance, your code didn't care about text-decoration. It's not about adding that text-decoration in ListExpression, but rather relying on existing code base.

I was also doubtful to restrict the scope to only this list, but that's a single line change.

@AyUsH18102001

Copy link
Copy Markdown
Contributor Author

Hello @onizet

Thats a valid point, but I think we should only cater to specific styles for list marker element i.e. styles included in MarkerStyle record with new addons like text-decoration i.e. (underline, strike and double strike)

I'll make sure to not dupliate the styles in ListExpression

@AyUsH18102001

Copy link
Copy Markdown
Contributor Author

Hello @onizet

I mis-interpreted your previous review comment, MarkerStyle although keeps a minimal styling its still the wrong approach as we would circle back to the same maintianence problem

The list item element styling is cascaded by its parent list element, ApplyListMarkerStyle method parses the RunProperties of the list item paragraph and assigns it to the ParagraphMarkRunProperties

I tried text-decoration: underline on the list item inline style. The text content is underlined, and the underline is present on the paragraph mark run properties, but in the output doc its not rendered on the number/marker.
The marker underline is applied through the numbering instance level run properties, this means if we add the underline element here it would be reflected on all number marker that point to this instance

Thanks for the review, let me know if you require any other changes or testcase to verify

@AyUsH18102001

Copy link
Copy Markdown
Contributor Author

Hello @onizet

I've resolved the merge conflicts please review and merge

Thanks

@onizet

onizet commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Hello,

What are you trying to solve with this PR? The styles are correctly cascaded to the list item, as per the call to expression.Interpret(context) and the context set to this numbering.

@AyUsH18102001

Copy link
Copy Markdown
Contributor Author

Hello @onizet
Yes you are correct the styles are correctly cascaded, this PR assigns the resolved paragraph properties in the ParagrapMarkRunProperties instance of the list item paragraph

Thanks

@AyUsH18102001

Copy link
Copy Markdown
Contributor Author

This was the requirement of the Issue #252

This branch has not been deployed

No deployments
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.

2 participants