I would like to have less
display *.md
markdown files with some formatting -- like I know less
can, for manpages, etc. I am running Ubuntu 12.04.
I am as far as putting a user defined filter into .lessfilter
:
#!/bin/sh
case "$1" in
*.md)
fn=/tmp/$1.$$.html
markdown "$1" | html2txt > $fn ### LOSES FORMATTING
cat $fn ### TO STDOUT???
;;
*)
# We don't handle this format
exit 1
esac
# No further processing by lesspipe necessary
exit 0
So, the main questions are:
- How can I pass some basic formatting information to
less
as well, instead of losing it withhtml2txt
- Is it correct to just print the new content to stdout? Or could I just write the
*.html
to file disk and letless
handle that html at its own digression (seeing the html-extension and acting on it?)