且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何配置“较少"以显示格式化的降价文件?

更新时间:2023-10-05 09:23:58

看看 Pandoc .它可以将文件从markdown格式转换为groff手册页,然后可以在 man 中查看.

Take a look at Pandoc. It can convert files from markdown format to groff man pages which you can then view in man.

您的 .lessfilter 脚本为:

case "$1" in
  *.md)
    pandoc -s -f markdown -t man "$1" | man -l -
    ;;

或者,使用 markdown 命令将其转换为html,然后使用 lynx 浏览器进行查看,但这对我来说并不是很好.

Alternatively, convert it to html using the markdown command and then use the lynx browser to view it, but this didn't work too well for me.

case "$1" in
  *.md)
    markdown "$1" | lynx -stdin
    ;;

是的, lessfilter 脚本必须写入标准输出.

And, yes, the lessfilter script must write to stdout.