Checklist: Add support for upper case 'X'

Requires an extra commit in markd
This commit is contained in:
Vishesh Handa
2020-04-06 01:14:36 +02:00
parent de2c82f4bd
commit 219e241deb
2 changed files with 8 additions and 5 deletions

View File

@ -327,9 +327,12 @@ class MarkdownRenderer implements md.NodeVisitor {
var attr = element.attributes; var attr = element.attributes;
print(attr); print(attr);
if (attr['class'] == 'todo' && attr['type'] == 'checkbox') { if (attr['class'] == 'todo' && attr['type'] == 'checkbox') {
bool val = attr.containsKey('checked'); if (attr.containsKey('checked')) {
if (val) { if (attr.containsKey('uppercase')) {
buffer.write('[X]');
} else {
buffer.write('[x]'); buffer.write('[x]');
}
} else { } else {
buffer.write('[ ]'); buffer.write('[ ]');
} }

View File

@ -229,7 +229,7 @@ How are you doing?
- [ ] item 1 - [ ] item 1
- [x] item 2 - [x] item 2
- [x] item 3 - [X] item 3
- [ ] item 4 - [ ] item 4
- [ ] item 5 - [ ] item 5
@ -282,7 +282,7 @@ How are you doing?
- [x] item 1 - [x] item 1
- [ ] Foo - [ ] Foo
- [x] item 3 - [X] item 3
- [ ] item 4 - [ ] item 4
- [ ] Howdy - [ ] Howdy