I then built the following section of document
\n\n.. role:: bolditalic\n :class: bolditalic\n\nthis is a bold and italics :bolditalic:`attempt`\n\n.. rst-class:: bolditalic\n\n This paragraph too is bold italic.\n\n
The paragraphs work fine and are styled with bold and italics, but the inline bolditalics does not.
\nHere is the stylelog. You can see that the class information is not applied to the inline element.
\n Paragraph('this is bold and italics attempt...') C:13 (Path/to/01_introduction.rst) <paragraph>\n > (0,0,0,0,2) body [Sphinx] > default\n MixedStyledText('this is a bold and italics attempt...')\n MixedStyledText('this is a bold and italics attempt...')\n SingleStyledText('this is a bold and italics ')\n MixedStyledText('attempt') <inline>\n SingleStyledText('attempt')\n Paragraph('This paragraph too is is bold it...') C:22 (Path/to/01_introduction.rst) <paragraph>\n > (2,0,0,1,2) bold and italic Paragraph [mystylesheet] > default\n (0,0,0,0,2) body [Sphinx] > default\n MixedStyledText('This paragraph too is bold it...')\n MixedStyledText('This paragraph too is bold it...')\n SingleStyledText('This paragraph too is bold it...')\n
So, I am a bit lost when it comes to this, it seems I can use the rst-class directive to pass on class information from the rst and then apply the style with rinohtype, but somewhere between the rst -> sphinx -> rinoh process I lose the class information for inline elements when using the role directive.
\nAny information would be greatly appreciated as I intend to style other inline elements with classes.
","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"I can't remember why the SingleStyledText
and MixedStyledText
selectors don't work, but the more generic StyledText
selector should definitely work. See hide.rts
(and hide.rst
) from the regression tests.
Using SingleStyledText
or MixedStyledText
should probably throw an error, since I don't think there are actual use cases for it.
-
Hi, RST does not support the combination of bold and italics, unlike markdown which supports it using the triple asterisk *** After reading this stack overflow answer I've attempted to implement a similar solution using Sphinx+rinohtype https://stackoverflow.com/a/22885876 To allow me to use this in my documents I have added the following to my stylesheet
I then built the following section of document
The paragraphs work fine and are styled with bold and italics, but the inline bolditalics does not. Here is the stylelog. You can see that the class information is not applied to the inline element.
So, I am a bit lost when it comes to this, it seems I can use the rst-class directive to pass on class information from the rst and then apply the style with rinohtype, but somewhere between the rst -> sphinx -> rinoh process I lose the class information for inline elements when using the role directive. Any information would be greatly appreciated as I intend to style other inline elements with classes. |
Beta Was this translation helpful? Give feedback.
-
I can't remember why the Using |
Beta Was this translation helpful? Give feedback.
-
Thank you! This solved my problem 👍 |
Beta Was this translation helpful? Give feedback.
I can't remember why the
SingleStyledText
andMixedStyledText
selectors don't work, but the more genericStyledText
selector should definitely work. Seehide.rts
(andhide.rst
) from the regression tests.Using
SingleStyledText
orMixedStyledText
should probably throw an error, since I don't think there are actual use cases for it.