diff --git a/.config/nvim/lua/configs/packer.lua b/.config/nvim/lua/configs/packer.lua index 0270ae1..de49bdb 100644 --- a/.config/nvim/lua/configs/packer.lua +++ b/.config/nvim/lua/configs/packer.lua @@ -97,6 +97,7 @@ return require('packer').startup(function(use) template_path = '~/.config/vimwiki/templates/cybersecurity/', template_default = 'default', template_ext = 'html', + css_name = 'css/styles.css', syntax = 'markdown', ext = '.md', custom_wiki2html = '~/.config/vimwiki/parse_wiki.py', diff --git a/.config/vimwiki/checkBoxParser.hs b/.config/vimwiki/checkBoxParser.hs new file mode 100755 index 0000000..23eaffe --- /dev/null +++ b/.config/vimwiki/checkBoxParser.hs @@ -0,0 +1,27 @@ +#!/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 diff --git a/.config/vimwiki/parse_wiki.py b/.config/vimwiki/parse_wiki.py index 66b6ab4..3450b05 100755 --- a/.config/vimwiki/parse_wiki.py +++ b/.config/vimwiki/parse_wiki.py @@ -47,6 +47,7 @@ def convert( command = [ "pandoc", "--filter={}/.config/vimwiki/linkParser.hs".format(os.environ['HOME']), + "--filter={}/.config/vimwiki/checkBoxParser.hs".format(os.environ['HOME']), "--section-divs", "--template={}".format(template) if path.isfile(template) else "", #"--variable=css={}".format(css_file) if path.isfile(css_file) else "", diff --git a/.config/vimwiki/templates/cybersecurity/default.html b/.config/vimwiki/templates/cybersecurity/default.html index 91f8929..84a9063 100644 --- a/.config/vimwiki/templates/cybersecurity/default.html +++ b/.config/vimwiki/templates/cybersecurity/default.html @@ -17,6 +17,7 @@ $if(description-meta)$ $endif$