refactor(views): adopt markdown checkbox line format

Problem: task lines used an opaque /ID/  [N] prefix format that was
hard to read and inconsistent between category and priority views.
Header lines had no visual marker distinguishing them from tasks.

Solution: render headers as '## Cat', task lines as
'/ID/- [x|!| ] description'. State encoding: [x]=done, [!]=urgent,
[ ]=pending. Both views use the same construction.
This commit is contained in:
Barrett Ruth 2026-02-24 23:14:32 -05:00
parent 4c8944c5ee
commit afb9e65f8d
2 changed files with 17 additions and 19 deletions

View file

@ -125,7 +125,7 @@ function M.category_view(tasks)
table.insert(lines, '')
table.insert(meta, { type = 'blank' })
end
table.insert(lines, cat)
table.insert(lines, '## ' .. cat)
table.insert(meta, { type = 'header', category = cat })
local all = {}
@ -138,9 +138,8 @@ function M.category_view(tasks)
for _, task in ipairs(all) do
local prefix = '/' .. task.id .. '/'
local indent = ' '
local prio = task.priority > 0 and ('[' .. task.priority .. '] ') or ''
local line = prefix .. indent .. prio .. task.description
local state = task.status == 'done' and 'x' or (task.priority > 0 and '!' or ' ')
local line = prefix .. '- [' .. state .. '] ' .. task.description
table.insert(lines, line)
table.insert(meta, {
type = 'task',
@ -189,9 +188,8 @@ function M.priority_view(tasks)
for _, task in ipairs(all) do
local prefix = '/' .. task.id .. '/'
local indent = ' '
local prio = task.priority == 1 and '! ' or ''
local line = prefix .. indent .. prio .. task.description
local state = task.status == 'done' and 'x' or (task.priority > 0 and '!' or ' ')
local line = prefix .. '- [' .. state .. '] ' .. task.description
table.insert(lines, line)
table.insert(meta, {
type = 'task',