File tree Expand file tree Collapse file tree 4 files changed +31
-2
lines changed
tests/test_renderers/fixtures Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 106106myst_heading_anchors = 2
107107myst_footnote_transition = True
108108myst_dmath_double_inline = True
109+ myst_enable_checkboxes = True
109110
110111# -- HTML output -------------------------------------------------
111112
Original file line number Diff line number Diff line change @@ -300,6 +300,15 @@ class MdParserConfig:
300300 },
301301 )
302302
303+ enable_checkboxes : bool = dc .field (
304+ default = False ,
305+ metadata = {
306+ "validator" : instance_of (bool ),
307+ "help" : "Enable checkboxes" ,
308+ "extension" : "tasklist" ,
309+ },
310+ )
311+
303312 # docutils only (replicating aspects of sphinx config)
304313
305314 suppress_warnings : Sequence [str ] = dc .field (
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def create_md_parser(
4848 # note, strikethrough currently only supported tentatively for HTML
4949 .enable ("strikethrough" )
5050 .enable ("table" )
51- .use (tasklists_plugin )
51+ .use (tasklists_plugin , enabled = config . enable_checkboxes )
5252 .enable ("linkify" )
5353 .use (wordcount_plugin , per_minute = config .words_per_minute )
5454 )
@@ -98,7 +98,7 @@ def create_md_parser(
9898 if "fieldlist" in config .enable_extensions :
9999 md .use (fieldlist_plugin )
100100 if "tasklist" in config .enable_extensions :
101- md .use (tasklists_plugin )
101+ md .use (tasklists_plugin , enabled = config . enable_checkboxes )
102102 if "substitution" in config .enable_extensions :
103103 md .use (substitution_plugin , * config .sub_delimiters )
104104 if "attrs_inline" in config .enable_extensions :
Original file line number Diff line number Diff line change @@ -156,6 +156,25 @@ www.commonmark.org/he<lp
156156 <lp
157157.
158158
159+ [tasklist] --myst-enable-extensions=tasklist --myst-enable-checkboxes="true"
160+ .
161+ - [ ] a
162+ - [x] b
163+ .
164+ <document source="<string>">
165+ <bullet_list bullet="-" classes="contains-task-list">
166+ <list_item classes="task-list-item enabled">
167+ <paragraph>
168+ <raw format="html" xml:space="preserve">
169+ <input class="task-list-item-checkbox" type="checkbox">
170+ a
171+ <list_item classes="task-list-item enabled">
172+ <paragraph>
173+ <raw format="html" xml:space="preserve">
174+ <input class="task-list-item-checkbox" checked="checked" type="checkbox">
175+ b
176+ .
177+
159178[heading_anchors] --myst-heading-anchors=1
160179.
161180# My title
You can’t perform that action at this time.
0 commit comments