Add support for string literals in CSS list-style-type property
Fixes #1504
This PR implements support for CSS string literals as list-style-type values, allowing developers to use custom text markers for HTML lists.
What's Changed
Previously, the list-style-type property only supported predefined CSS keywords like disc, circle, decimal, etc. This implementation adds support for quoted string literals as specified in the CSS specification.
Examples
<!-- Custom numbered markers -->
<ul style="list-style-type: '① '">
<li>First item</li>
<li>Second item</li>
</ul>
<!-- Custom text markers -->
<ol style="list-style-type: 'Step '">
<li>Initialize</li>
<li>Process</li>
</ol>
<!-- Empty string (no marker) -->
<ul style="list-style-type: ''">
<li>Item without marker</li>
</ul>
Implementation Details
-
String Detection: Modified
getListMarkerText()to treat any unrecognized list-style-type value as a string literal -
Quote Handling: The CSS parser already handles quote extraction and HTML entity decoding (
"→") -
Empty Strings: Empty string literals properly render without markers (like
list-style-type: none) - Compatibility: All existing functionality preserved - geometric markers (disc, circle, square) and serial markers (decimal, roman, alpha) work unchanged
Technical Changes
- Updated
getListMarkerText()incore_widget_factory.dartto return unrecognized types as-is - Modified
buildListMarker()to handle empty string literals by returningnull(no marker) - Added
_isPredefinedListStyleType()helper to distinguish between CSS keywords and string literals - Enhanced test coverage with comprehensive string literal test cases
Test Results
- ✅ All existing tests pass (70/70 core package tests)
- ✅ All integration tests pass (46/46 enhanced package tests)
- ✅ Full test suite passes (233/233 total tests)
- ✅ End-to-end verification confirms custom markers render correctly
This change maintains full backward compatibility while enabling the flexible list styling requested in the original issue.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code
Demo app
73e33b9beaae9ee560824b8b7f3483462078a495 APKs:
- app-armeabi-v7a-release.apk
- app-arm64-v8a-release.apk
- app-x86_64-release.apk
- Debug APK via https://appetize.io
Web build has been deployed to https://demo-5sgtf4mtg-fwfh.vercel.app. Quick links: