如何使用带有尾随空格的内联代码? [英] How to use inline code with a trailing whitespace?
问题描述
当我使用
``# ``
在我的 Sphinx 文档中,我收到以下警告:
in my Sphinx documentation I get the following warning:
WARNING: Inline literal start-string without end-string.
尝试
:samp:`# `
导致
WARNING: Inline interpreted text or phrase reference start-string without end-string.
问题似乎是尾随空格,但我想不出解决这个问题的方法.使用反斜杠 (\
) 转义空格也无济于事(对于第一个示例,警告仍然存在,对于第二个示例,生成的文档中省略了空格).
The problem seems to be the trailing whitespace however I couldn't figure out a way of getting around this problem. Escaping the whitespace with a backslash (\
) doesn't help either (for the first example the warning persists and for the second example the whitespace is omitted in the generated docs).
这个答案不起作用,因为内联代码部分解释了 |space|
作为文字字符串.
This answer doesn't work because the inline code section interprets the |space|
as a literal string.
使用过 Sphinx 1.6.2.
Experienced with Sphinx 1.6.2.
推荐答案
解决方法是使用不间断空格字符 (U+00A0) 而不是常规空格 (U+0020) 作为尾随空格.
A workaround is to use a no-break space character (U+00A0) instead of a regular space (U+0020) for the trailing whitespace.
>
有几种方法可以插入文字不间断空格字符.请参阅https://en.wikipedia.org/wiki/Non-breaking_space#Keyboard_entry_methods一>.
这篇关于如何使用带有尾随空格的内联代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!