API

Types

DueView

DueView

A timeline HTML view of a TodoFile showing time remaining until each task is due. Tasks need a due metadata key (e.g. due:2024-02-01) to appear. Bars are colored by urgency: overdue (red), ≤3 days (orange), ≤7 days (yellow), ≤14 days (green), >14 days (blue).

The today field defaults to Dates.today() but can be overridden for testing.

Examples

julia> tf = TodoFile("todo.txt")

julia> DueView(tf)
DueView(3 tasks)

GanttView

GanttView

A Gantt chart HTML view of a TodoFile. Tasks are displayed as horizontal bars on a timeline. A task needs a creation_date (start) and either a due metadata key or completion_date (end) to appear on the chart.

Examples

julia> tf = TodoFile("todo.txt")

julia> GanttView(tf)
GanttView(3 tasks)

KanbanView

KanbanView

A kanban board HTML view of a TodoFile, grouped by a specified field.

Examples

julia> tf = TodoFile("todo.txt")

julia> KanbanView(tf, :priority)
KanbanView(3 tasks, group_by=:priority)

julia> KanbanView(tf)  # defaults to :priority
KanbanView(3 tasks, group_by=:priority)

ListView

ListView

A card-style HTML list view of a TodoFile. Display in Jupyter/Pluto notebooks via their rich HTML rendering.

Examples

julia> tf = TodoFile("todo.txt")

julia> ListView(tf)
ListView(3 tasks)

MarkdownTodoFile

MarkdownTodoFile

A markdown file with TodoSections, where #-headings define sections and - list items are todo entries in Todo.txt format. Existing HTML views work via automatic flattening of all todos.

Examples

julia> mf = MarkdownTodoFile("todos.md")

julia> length(mf)
5

julia> mf[1]
Todo: (A) Call Mom @phone +Family
MarkdownTodoFile(filepath::AbstractString)

Read a markdown file and return a MarkdownTodoFile.

TableView

TableView

A tabular HTML view of a TodoFile.

Examples

julia> tf = TodoFile("todo.txt")

julia> TableView(tf)
TableView(3 tasks)

Todo

Todo

A single task in the Todo.txt format.

Fields

  • completed::Bool: Whether the task is marked complete (x).
  • priority::Union{Char, Nothing}: Priority letter 'A''Z', or nothing.
  • completion_date::Union{Date, Nothing}: Date the task was completed.
  • creation_date::Union{Date, Nothing}: Date the task was created.
  • description::String: The task description text (tags are stored separately).
  • contexts::Vector{String}: @context tags.
  • projects::Vector{String}: +project tags.
  • metadata::Dict{String, String}: key:value pairs.
  • subtasks::Vector{Todo}: Nested sub-tasks (used by MarkdownTodoFile; empty for flat Todo.txt).
  • notes::String: Blockquote notes associated with the task (used by MarkdownTodoFile; empty for flat Todo.txt).

Examples

julia> t = parse_todo("(A) 2024-01-15 Call Mom @phone +Family due:2024-01-20")
Todo: (A) 2024-01-15 Call Mom @phone +Family due:2024-01-20

julia> t.priority
'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase)

julia> t.contexts
["phone"]

julia> t.projects
["Family"]

julia> t.metadata
Dict{String, String} with 1 entry:
  "due" => "2024-01-20"

TodoFile

TodoFile

A Todo.txt file represented as a filepath and a vector of Todo items. Implements the Tables.jl interface for interoperability with DataFrames, CSV, and other tabular data packages.

Examples

julia> tf = TodoFile("todo.txt")

julia> length(tf)
3

julia> tf[1]
Todo: (A) Call Mom @phone +Family

julia> write_todos(tf)  # writes back to tf.filepath
TodoFile(filepath::AbstractString)

Read a Todo.txt file and return a TodoFile.

TodoSection

TodoSection

A group of Todo items under a markdown heading.

Fields

  • heading::String: The heading text (empty string for todos before any heading).
  • level::Int: The heading level (1 for #, 2 for ##, etc.; 0 for no heading).
  • todos::Vector{Todo}: The tasks in this section.

Functions

html_view

html_view(tf::TodoFile; view::Symbol=:list, group_by::Symbol=:priority)

Create an HTML view of a TodoFile for rich display in notebooks.

Returns a ListView, TableView, KanbanView, GanttView, or DueView.

Examples

julia> tf = TodoFile("todo.txt")

julia> html_view(tf)
ListView(3 tasks)

julia> html_view(tf; view=:table)
TableView(3 tasks)

julia> html_view(tf; view=:kanban, group_by=:projects)
KanbanView(3 tasks, group_by=:projects)

julia> html_view(tf; view=:gantt)
GanttView(3 tasks)

julia> html_view(tf; view=:due)
DueView(3 tasks)
html_view(mf::MarkdownTodoFile; view::Symbol=:list, group_by::Symbol=:priority)

Create an HTML view of a MarkdownTodoFile. See html_view(::TodoFile) for options.

parse_markdown_todos

No documentation found for public binding TodoFiles.parse_markdown_todos.

TodoFiles.parse_markdown_todos is a Function.

# 1 method for generic function "parse_markdown_todos" from TodoFiles:
 [1] parse_markdown_todos(text::AbstractString)
     @ ~/work/TodoFiles.jl/TodoFiles.jl/src/TodoFiles.jl:467

parse_todo

parse_todo(line::AbstractString) -> Todo

Parse a single line of Todo.txt format into a Todo.

Examples

julia> parse_todo("(A) 2024-01-15 Call Mom @phone +Family")
Todo: (A) 2024-01-15 Call Mom @phone +Family

julia> parse_todo("x 2024-01-16 2024-01-15 Call Mom @phone +Family")
Todo: x 2024-01-16 2024-01-15 Call Mom @phone +Family

parse_todos

parse_todos(text::AbstractString) -> Vector{Todo}

Parse multiple lines of Todo.txt format into a vector of Todo items. Blank lines are skipped.

Examples

julia> todos = parse_todos("""
       (A) Call Mom @phone
       (B) Buy groceries @store +Errands

       x 2024-01-15 Pay bills
       """)
3-element Vector{Todo}:
 Todo: (A) Call Mom @phone
 Todo: (B) Buy groceries @store +Errands
 Todo: x 2024-01-15 Pay bills

read_markdown_todos

read_markdown_todos(filepath::AbstractString) -> Vector{TodoSection}

Read a markdown file and parse it into TodoSections.

Examples

julia> sections = read_markdown_todos("todos.md")

read_todos

read_todos(filepath::AbstractString) -> Vector{Todo}

Read a Todo.txt file and return a vector of Todo items.

Examples

julia> todos = read_todos("todo.txt")

write_markdown_todos

write_markdown_todos(sections::Vector{TodoSection}) -> String

Serialize TodoSections to a markdown string with #-headings and - list items.

write_markdown_todos(filepath::AbstractString, sections::Vector{TodoSection})

Write TodoSections to a markdown file.

write_todo

write_todo(t::Todo) -> String

Serialize a Todo back to a single Todo.txt formatted line.

Examples

julia> t = Todo("Call Mom @phone +Family"; priority='A', creation_date=Date(2024, 1, 15))
Todo: (A) 2024-01-15 Call Mom @phone +Family

julia> write_todo(t)
"(A) 2024-01-15 Call Mom @phone +Family"

write_todos

write_todos(todos::Vector{Todo}) -> String

Serialize a vector of Todo items into a Todo.txt formatted string.

write_todos(filepath::AbstractString, todos::Vector{Todo})

Write a vector of Todo items to a file in Todo.txt format.

Examples

julia> write_todos("todo.txt", todos)
write_todos(tf::TodoFile)

Write a TodoFile back to its filepath.

write_todos(mf::MarkdownTodoFile)

Write a MarkdownTodoFile back to its filepath.