commit 99ef313afdd0aa15604510224428bb2fde519e9a parent c54f7b4637161a05ef20da4775ef00893137e4b2 Author: Alex Balgavy <a.balgavy@gmail.com> Date: Thu, 22 Nov 2018 20:53:32 +0100 Convert vimwiki files to markdown Diffstat:
A | bin/vimwiki_md | | | 6 | ++++++ |
A | bin/vimwiki_md_ex | | | 9 | +++++++++ |
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/bin/vimwiki_md b/bin/vimwiki_md @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +for x in "$@"; do + filename=$(sed -e "s/\.wiki$/.md/" <<< "$x") + sed -f $(dirname "$0")/vimwiki_md_ex -E "$x" > "$filename" +done diff --git a/bin/vimwiki_md_ex b/bin/vimwiki_md_ex @@ -0,0 +1,9 @@ +s/^={1}([^=])/#\1/ +s/^={2}([^=])/##\1/ +s/^={3}([^=])/###\1/ +s/ =*$// +s/^-/\ +*/ +s/^([ ]*)-/\1*/ +s/\[\[(https?:\/\/[^]|]*)\]\]/[\1](\1)/g +s/\[\[(https?:\/\/[^|]*)\|([^]]*)\]\]/[\2](\1)/g