通常,与sphinx相关的最佳做法是说您必须将行长度限制为少于80个字符。
所以我想要一种方法来自动将我的行长度限制为少于80个字符(没有连字符),并且当纠正发生时,它必须放置正确的缩进(如果可能的话)。 我见过的唯一一个似乎适合的功能是Textwrap http://docs.python.org/library/textwrap.html 有人有这方面的经验吗?也许更好的主意?该功能已经在sphinx捆绑但我找不到它?我想念stackoverflow中的一个主题吗?
欢迎任何输入。
答案 0 :(得分:1)
你需要一个血统编辑器。
例如,在vim中,这可以通过执行以下操作来处理:
:set textwidth=80
然后你要做的就是开始输入,vim将在下一行继续。
标记文本并执行gq
根据“textwidth”变量的设置重新格式化选择。
实施例。
In those days spirits were brave, the stakes were high, men were real men, women were real women and small furry creatures from Alpha Centauri were real small furry creatures from Alpha Centauri.
在设置tw=30
后的vim中,选择文字并执行gq
:
In those days spirits were
brave, the stakes were high,
men were real men, women were
real women and small furry
creatures from Alpha Centauri
were real small furry
creatures from Alpha Centauri.