From 219e241deb2b3781e29d67fdc75a64495a5cf7b5 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Mon, 6 Apr 2020 01:14:36 +0200 Subject: [PATCH] Checklist: Add support for upper case 'X' Requires an extra commit in markd --- lib/core/checklist.dart | 9 ++++++--- test/checklist_test.dart | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/core/checklist.dart b/lib/core/checklist.dart index 23d305c9..d9718889 100644 --- a/lib/core/checklist.dart +++ b/lib/core/checklist.dart @@ -327,9 +327,12 @@ class MarkdownRenderer implements md.NodeVisitor { var attr = element.attributes; print(attr); if (attr['class'] == 'todo' && attr['type'] == 'checkbox') { - bool val = attr.containsKey('checked'); - if (val) { - buffer.write('[x]'); + if (attr.containsKey('checked')) { + if (attr.containsKey('uppercase')) { + buffer.write('[X]'); + } else { + buffer.write('[x]'); + } } else { buffer.write('[ ]'); } diff --git a/test/checklist_test.dart b/test/checklist_test.dart index 3d078ff2..def2642c 100644 --- a/test/checklist_test.dart +++ b/test/checklist_test.dart @@ -229,7 +229,7 @@ How are you doing? - [ ] item 1 - [x] item 2 -- [x] item 3 +- [X] item 3 - [ ] item 4 - [ ] item 5 @@ -282,7 +282,7 @@ How are you doing? - [x] item 1 - [ ] Foo -- [x] item 3 +- [X] item 3 - [ ] item 4 - [ ] Howdy