Skip to content

Commit eb7033c

Browse files
#5815 Added support for 'dash' list-item-type. Removed indentation when item type is 'none'.
1 parent 7e188f3 commit eb7033c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/src/processing/lists.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,23 @@ import 'package:flutter_html/flutter_html.dart';
55
import 'package:list_counter/list_counter.dart';
66

77
class ListProcessing {
8+
static final dash = CounterStyle.define(
9+
name: 'dash',
10+
system: System.cyclic,
11+
symbols: ['—'],
12+
suffix: ' ',
13+
);
14+
15+
static final none = CounterStyle.define(
16+
name: 'none',
17+
system: System.cyclic,
18+
symbols: [''],
19+
suffix: '',
20+
);
21+
822
static StyledElement processLists(StyledElement tree) {
23+
CounterStyleRegistry.register(none);
24+
CounterStyleRegistry.register(dash);
925
tree = _preprocessListMarkers(tree);
1026
tree = _processListCounters(tree);
1127
tree = _processListMarkers(tree);
@@ -96,6 +112,9 @@ class ListProcessing {
96112
/// [_processListMarkers] finally applies the marker content to the tree
97113
/// as a [Marker] on the [Style] object.
98114
static StyledElement _processListMarkers(StyledElement tree) {
115+
if(tree.name == 'ul' && tree.style.listStyleType?.counterStyle == 'none'){
116+
tree.style.padding = null;
117+
}
99118
if (tree.style.display == Display.listItem) {
100119
final listStyleType = tree.style.listStyleType ?? ListStyleType.decimal;
101120
final counterStyle = CounterStyleRegistry.lookup(

lib/src/style.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ enum ListStyleType {
612612
cjkEarthlyBranch('cjk-earthly-branch'),
613613
cjkHeavenlyStem('cjk-heavenly-stem'),
614614
cjkIdeographic('cjk-ideographic'),
615+
dash('dash'),
615616
decimal('decimal'),
616617
decimalLeadingZero('decimal-leading-zero'),
617618
devanagari('devanagari'),

0 commit comments

Comments
 (0)