diff --git a/roles/home-cli/files/markdown.sh b/roles/home-cli/files/markdown.sh new file mode 100644 index 0000000..c653ea6 --- /dev/null +++ b/roles/home-cli/files/markdown.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -e +command -v cmark >/dev/null || (echo "cmark: command not found" >&2 && exit 1) +test -n "$2" || (echo "Usage: $0 \"Document title\" filename1 [filename2...]" >&2 && exit 1) +cat << __EOF__ + + + +$1 + + + +__EOF__ +shift # Drop the first argument (document title). +cmark --to html --nobreaks --unsafe --smart --validate-utf8 $* +cat << __EOF__ + + +__EOF__ diff --git a/roles/home-cli/files/profile b/roles/home-cli/files/profile index 8ab3ed8..f870756 100644 --- a/roles/home-cli/files/profile +++ b/roles/home-cli/files/profile @@ -243,7 +243,6 @@ alias isodate="date +'Date: %Y-%m-%d%nTime: %H:%M:%S%nZone: %:z%n%nWeek: %G-W%V- alias la="ls -a" alias ll="ls -l" alias ls="command ls -F" -alias markdown="cmark --to html --nobreaks --unsafe --smart --validate-utf8" alias now="date +%Y%m%dT%H%M%S%z" alias nowh="date +%Y-%m-%dT%H:%M:%S%:z" alias nowu="date -u +%Y%m%dT%H%M%SZ" diff --git a/roles/home-cli/tasks/dotfiles.yaml b/roles/home-cli/tasks/dotfiles.yaml index 99385de..1e6cc64 100644 --- a/roles/home-cli/tasks/dotfiles.yaml +++ b/roles/home-cli/tasks/dotfiles.yaml @@ -97,3 +97,8 @@ state: link force: yes follow: false +- name: Create $HOME/.local/bin/markdown + ansible.builtin.copy: + src: markdown.sh + dest: "{{ ansible_env.HOME }}/.local/bin/markdown" + mode: '0755'