如何在代码环境中强制reStructuredText中不间断的空间?

mar*_*aft 7 restructuredtext python-sphinx

我在reStructuredText文档中有这个片段:

  1. Find the file at ``~/Google Drive/code/mac/install.sh``.
Run Code Online (Sandbox Code Playgroud)

注意代码/引用环境.注意路径之间GoogleDrive路径之间的空间.

当用HTML中的Sphinx渲染时,在Google和之间有一个换行Drive,并且空间消失了.(由于这是文档,我需要代码环境中的所有内容完全按照输入的方式显示给用户,其中包括"Google"和"Drive"之间的空间.不仅应该有空格,还应该用阴影显示灰色就像代码环境中的所有其他代码一样)

如何告诉reStructuredText在该位置使用不间断的空间?

mzj*_*zjn 2

如果在 reST 文件中用不间断空格 (U+00A0) 替换常规空格字符,它对我有用。这将产生一个包含在输出中<span>的元素:Google&nbsp;Drive

<span class="pre">~/Google&nbsp;Drive/code/mac/install.sh</span>
Run Code Online (Sandbox Code Playgroud)

插入文字不间断空格可以通过多种方式完成。请参阅https://en.wikipedia.org/wiki/Non-breaking_space#Keyboard_entry_methods