dotfiles/.local/bin/scripts/mdoh

10 lines
287 B
Plaintext
Raw Normal View History

2022-11-19 18:58:57 +00:00
#!/bin/sh
# Transforms org to markdown using a simplified regex
sed ':o; s/_\(\w[^_]*\w\)_/\/\1\//g;
/^#\+ /{
s/^#/*/; To;
:b; s/^\(\**\)#/\1*/g; tb;
n; s/^$//; To; D
}' "$@"
# echo "# one\n\n# two\n## under #two\n_hello under_two_\nnumber #1" | mdoh