Direct markdown/wikitext checkboxes !?

Here’s an example of pure wikitext checklists based on a viewtemplate and functions.
It’s very basic feature-wise, no D’n’D, no sorting, no sub-lists, but checkbox state can be toggled in view mode.

Syntax:

[ ] empty checkbox
[x] checked checkbox
[X] checked checkbox, with a capitalized X
[ ].userClass a checkbox with user-defined CSS class

So this:


is rendered like this:

Limits:

  • Checkboxes must be at the beginning of the line.
  • Empty checkboxes without a space between brackets won’t work (sorry @twMat)

Things that could/should change:

  • Promote procedures and functions to a $:/tags/Global-tagged tiddler
  • Make default classes configurable
  • Include the viewtemplate in ViewTemplateBody cascade
  • Checkboxes should be rendered and functional in edit-mode preview (might happen when previous item is done)
  • Replace currently generated <li><$button>...</li> by a custom widget

Things I won’t do myself:

  • Add advanced functionalities (sorting, D’n’D, new item input, …) as I won’t need them :man_shrugging:

Please feel free to reuse the code as you wish.

The code might interfere with other solutions like @hoopyfrood’s or Grossinger’s.
As usual, don’t try it on important data, and be sure to have a backup before proceeding.

wikitext-checklists.json (5.3 KB)

Import this file in an empty wiki, then open “Result of wikitext-checklist transformation” tiddler.
Example wikitext is in “Wikitext-checklist test text”, and the code is in the template: “wikitext-checklist-viewtemplate”.

Fred