literal percent sign in literal text

25 views
Skip to first unread message

Bob DuCharme

unread,
Dec 16, 2019, 3:24:35 PM12/16/19
to sphinx-users
When I have a percent sign in literal text it italicizes the character after it and they both are shown in a lighter color. For example: 


:: 

       here is text '%sample'

In the HTML rendered by Sphinx, the 's' above will be italicized and the '%s' show up in a lighter color. Backslash doesn't help. If I make it '%%sample', there is no italicizing but both percent signs show up. 

How can I make the "here is" line above show up as-is after doing a Sphinx build? 

Thanks,

Bob

Stefano David

unread,
Dec 17, 2019, 5:40:43 AM12/17/19
to sphinx-users
Hi Bob,
Perhaps not exactly what you want, but...

.. raw:: html
   <pre>here is text '%sample'</pre>
 
.. raw:: html    
   <div class="highlight-default notranslate"><div class="highlight"><pre>here is text '%sample'</pre></div></div


might be of some help?  (I just took the classes in you example's output and put them as raw html, without the nested spans that actually create the highlight)
HTH,
Stefano

Message has been deleted
Message has been deleted

Bob DuCharme

unread,
Dec 17, 2019, 9:25:45 AM12/17/19
to sphinx-users
Thanks Stefano, that worked! It took me a while to get the spacing right, but now I have just what I want. 

I didn't know about "raw:: html". That's going to be useful in the future. 

Bob

Komiya Takeshi

unread,
Dec 17, 2019, 9:36:09 AM12/17/19
to sphinx...@googlegroups.com
Hi Bob,

By default, Sphinx considers all of code-block is a python code. So it
is highlighted as python code. Not to highlight them as python, please
configure "highlight_language = 'none'" in your conf.py.
see https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-highlight_language

Thanks,
Takeshi KOMIYA

2019年12月17日(火) 5:24 Bob DuCharme <bob.du...@ccri.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/a69cb57a-b5dd-4423-8a55-34fcb543fe55%40googlegroups.com.

Bob DuCharme

unread,
Dec 17, 2019, 10:58:00 AM12/17/19
to sphinx-users
Thanks Takeshi, that also worked and is good to know about. 

Bob


On Tuesday, December 17, 2019 at 9:36:09 AM UTC-5, Komiya Takeshi wrote:
Hi Bob,

By default, Sphinx considers all of code-block is a python code. So it
is highlighted as python code. Not to highlight them as python, please
configure "highlight_language = 'none'" in your conf.py.
see https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-highlight_language

Thanks,
Takeshi KOMIYA

2019年12月17日(火) 5:24 Bob DuCharme <bob.d...@ccri.com>:
>
> When I have a percent sign in literal text it italicizes the character after it and they both are shown in a lighter color. For example:
>
>
> ::
>
>        here is text '%sample'
>
> In the HTML rendered by Sphinx, the 's' above will be italicized and the '%s' show up in a lighter color. Backslash doesn't help. If I make it '%%sample', there is no italicizing but both percent signs show up.
>
> How can I make the "here is" line above show up as-is after doing a Sphinx build?
>
> Thanks,
>
> Bob
>
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages