忽略双空格对齐纯文本

忽略双空格对齐纯文本

我想调整一个纯文本文件(实际上是一个 markdown 文件),其中一些行以双倍空格结尾:

some lines which
can be justified with a little care
and attention. 

The following tough should not 
be changed as this line ends in a double space:  
some new line

I would also like to have some itemised list:  
 * The above line also ends in a double space.
 However, this line ends in a single space.
 * A new bullet.  
    - Some sub item.

在此处输入图片描述

上面的一些行以双空格结尾,这应该在 markdown 中表示新行。我想要一个命令行命令(或 bash 脚本?)来证明这一点,例如当使用时,par命令par j1w50 < misc.markdown > misc_new.markdown的输出是

some lines  which can  be justified with  a little
care and attention.

The following tough should  not be changed as this
line ends in a double space: some new line

I would  also like to  have some itemised  list: *
The  above  line  also  ends in  a  double  space.
However, this line ends in a single space. * A new
bullet. - Some sub item.

不保留 markdown 格式:

在此处输入图片描述

我被这个解决方案的简单性所吸引par,所以想避免自己创建任何大脚本。

以下问题类似/相关,但并不特定于 Markdown 语言的双倍空格问题:-Par:对齐文本而不连接线 -如何在 Linux 中对齐纯文本?

相关内容