| 1 |
.. include:: ../header.rst |
| 2 |
|
| 3 |
=================== |
| 4 |
Docutils TODO lists |
| 5 |
=================== |
| 6 |
|
| 7 |
TODO lists allow you to create a list of items with checkboxes. |
| 8 |
In `extended Markdown`_, they are called `task lists`. |
| 9 |
|
| 10 |
Checkbox variants |
| 11 |
================= |
| 12 |
|
| 13 |
[x] ASCII-art checkbox. |
| 14 |
|
| 15 |
[ ] ASCII space character and NBSP are smaller than the x. |
| 16 |
|
| 17 |
[ ] The "figure space" has the correct width but is not easy to type. |
| 18 |
|
| 19 |
You may define substitutions for ballot box and checked ballot box or |
| 20 |
other suitable Unicode characters: |
| 21 |
|
| 22 |
.. |-| unicode:: U+2610 |
| 23 |
.. |x| unicode:: U+2611 |
| 24 |
.. |y| unicode:: U+1F5F9 |
| 25 |
|
| 26 |
|-| U+2610 BALLOT BOX |
| 27 |
|
| 28 |
|x| U+2611 BALLOT BOX WITH CHECK |
| 29 |
|
| 30 |
|y| U+1F5F9 BALLOT BOX WITH BOLD CHECK |
| 31 |
|
| 32 |
List Markup |
| 33 |
=========== |
| 34 |
|
| 35 |
Paragraphs |
| 36 |
---------- |
| 37 |
|
| 38 |
|x| Simple *paragraphs* are easy for small lists with short values |
| 39 |
|
| 40 |
|-| but not well suited for complex TODO items. |
| 41 |
|
| 42 |
Line Blocks |
| 43 |
----------- |
| 44 |
|
| 45 |
| |x| Line blocks are rendered as "unstyled" lists. |
| 46 |
| |y| They don't need additional styling. |
| 47 |
| |-| However, you cannot nest block elements. |
| 48 |
|
| 49 |
|
| 50 |
Description Lists |
| 51 |
----------------- |
| 52 |
|
| 53 |
.. class:: description |
| 54 |
|
| 55 |
|x| |
| 56 |
A *description list* works out of the box in HTML5 and XeTeX. |
| 57 |
|
| 58 |
|-| |
| 59 |
It looks suboptimal in the rST source (definition list with class |
| 60 |
value "description"). |
| 61 |
|
| 62 |
[x] |
| 63 |
Lists may use ASCII-art or substitutions. |
| 64 |
|
| 65 |
[ ] |
| 66 |
All list markup variants require special styling based on a |
| 67 |
preceding class__ directive. |
| 68 |
|
| 69 |
__ https://docutils.sourceforge.io/docs/ref/rst/directives.html#class |
| 70 |
|
| 71 |
Bullet Lists |
| 72 |
------------ |
| 73 |
|
| 74 |
.. class:: todo |
| 75 |
|
| 76 |
- |x| bullet lists (similar to the Markdown_ for `task |
| 77 |
lists`) can be styled accordingly. |
| 78 |
- |-| They don't look good in the rST source. |
| 79 |
- [x] Lists may use ASCII-art or substitutions. |
| 80 |
- [ ] The "figure space" has the correct width. |
| 81 |
|
| 82 |
- |x| Another idea: use bullet lists with ``+`` and ``-`` markers. |
| 83 |
|
| 84 |
+ Clean and simple markup in the source. |
| 85 |
|
| 86 |
- A new marker character starts a new list :-( |
| 87 |
|
| 88 |
- Requires change to the writer: Pass the "bullet" attribute to |
| 89 |
the output document (use `HTML5 "data-" attriibutes`__?). |
| 90 |
|
| 91 |
__ https://html.spec.whatwg.org/#embedding-custom-non-visible-data-with-the-data-*-attributes |
| 92 |
|
| 93 |
Field Lists |
| 94 |
----------- |
| 95 |
|
| 96 |
.. class:: todo |
| 97 |
|
| 98 |
:|x|: Compile this example with ``rst2html5``, |
| 99 |
:|y|: compare markup variants, |
| 100 |
:|-|: select the best. |
| 101 |
|
| 102 |
.. class:: todo monospace |
| 103 |
|
| 104 |
:[x]: ASCII-art checkbox. |
| 105 |
:[ ]: The "figure space" has the correct width. |
| 106 |
:[ ]: CSS styling can switch to monospace fonts for the ASCII-art boxes, |
| 107 |
so an ASCII space character can be used. |
| 108 |
|
| 109 |
.. class:: todo monospace brackets |
| 110 |
|
| 111 |
:x: ASCII-art checkbox - brackets added by CSS. |
| 112 |
: : Simple rST source, easy typing. |
| 113 |
|
| 114 |
.. class:: todo monospace framed |
| 115 |
|
| 116 |
:x: checkbox border added by CSS. |
| 117 |
: : Simple rST source, easy typing. |
| 118 |
|
| 119 |
I recommend a field list with class argument and some CSS styling. |
| 120 |
|
| 121 |
|
| 122 |
.. _Markdown: https://www.markdownguide.org |
| 123 |
.. _extended Markdown: https://www.markdownguide.org/extended-syntax/ |
| 124 |
|
| 125 |
|
| 126 |
.. ! The follwing CSS rules are included here as raw HTML to keep the |
| 127 |
example compact. They compromise the HTML validity, as styling is not |
| 128 |
allowed in the document body. |
| 129 |
For production use, place CSS styling rules in a custom style sheet. |
| 130 |
|
| 131 |
.. raw:: html |
| 132 |
|
| 133 |
<style type="text/css"><!-- |
| 134 |
ul.todo {list-style-type: none; |
| 135 |
padding-left: 0;} |
| 136 |
ul.todo > li > p {padding-left: 1.2em; |
| 137 |
text-indent: -1.2em;} |
| 138 |
|
| 139 |
dl.todo > dt {font-style: normal} |
| 140 |
dl.todo > dt > .colon {display: none} |
| 141 |
dl.todo > dd {margin-left: 2.5em;} |
| 142 |
|
| 143 |
dl.monospace > dt {font-family: monospace;} |
| 144 |
|
| 145 |
dl.brackets > dt:before {content: '[';} |
| 146 |
dl.brackets > dt:after {content: ']';} |
| 147 |
|
| 148 |
dl.framed > dt {border: solid; |
| 149 |
border-width: thin; |
| 150 |
padding: 0 0.2em; |
| 151 |
margin-top: 0.2em; |
| 152 |
line-height: 0.9; |
| 153 |
} |
| 154 |
|
| 155 |
--></style> |