Files
dotfiles/.config/vimwiki/checkBoxParser.hs
Daniele Pintore a95ea69f32 Added checkboxparser to parse check list,
Modified the way css file works: now it isn't included in each html
file so we don't need to regenerate the whole wiki just for a small
change
2024-02-26 19:22:11 +01:00

28 lines
860 B
Haskell
Executable File

#!/usr/bin/env runhaskell
-- This simple filter that replaces the default checkboxes with cool ones from the
-- utf-8 charset, the checklist displayed still contains the marker, which can
-- avoided by adding the task-list class to the div containing the checklist in
-- the markdown. ex:
--
-- Example.md
-- :::{.task-list}
-- - [x] item1
-- - [ ] item2
-- - [ ] item3
-- - [ ] item4
-- :::
--
-- This list will be rendered without the marker
import Text.Pandoc.JSON
import Data.Text (pack, unpack)
import qualified Data.Text as T
main = toJSONFilter checkBoxParser
checkBoxParser :: Inline -> Inline
-- checkBoxParser (Str T.pack "\9746") = Str (pack "pippo")
checkBoxParser (Str text) | T.unpack text == "\9746" = Str (T.pack "\9989")
checkBoxParser (Str text) | T.unpack text == "\9744" = Str (T.pack "\11036\65039")
checkBoxParser x = x