diff options
author | Ben Bridle <ben@derelict.engineering> | 2025-01-19 22:10:32 +1300 |
---|---|---|
committer | Ben Bridle <ben@derelict.engineering> | 2025-01-19 22:10:46 +1300 |
commit | fac01d5209781ea61597941366c8fbc4514dad94 (patch) | |
tree | 6d6215d376e7bd96e827b2adf0d7051a352345f6 /src | |
parent | 0120714fc9c27da97745afe5b0b28f74c7136116 (diff) | |
download | toaster-fac01d5209781ea61597941366c8fbc4514dad94.zip |
Expand list of recognised checkbox formats
Checkboxes on list lines no longer have to be inside a monospace line
element.
Diffstat (limited to 'src')
-rw-r--r-- | src/generate_html.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/generate_html.rs b/src/generate_html.rs index 47dc5bf..c0026fb 100644 --- a/src/generate_html.rs +++ b/src/generate_html.rs @@ -146,6 +146,15 @@ pub fn document_to_html(document: &MarkdownDocument, page: &Page, website: &Webs } else if let Some(stripped) = output.strip_prefix("<code>[X]</code>") { output = format!("<input type='checkbox' disabled checked>{stripped}"); class.push_str(" checkbox"); + }else if let Some(stripped) = output.strip_prefix("[ ]") { + output = format!("<input type='checkbox' disabled>{stripped}"); + class.push_str(" checkbox"); + } else if let Some(stripped) = output.strip_prefix("[x]") { + output = format!("<input type='checkbox' disabled checked>{stripped}"); + class.push_str(" checkbox"); + } else if let Some(stripped) = output.strip_prefix("[X]") { + output = format!("<input type='checkbox' disabled checked>{stripped}"); + class.push_str(" checkbox"); } let class = class.trim(); html!("<li class='{class}'>{output}</li>") |