Skip to content
\n

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
\n

The paragraphs work fine and are styled with bold and italics, but the inline bolditalics does not.

\n

Here 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
\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.

\n

Any 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.

\n

Using SingleStyledText or MixedStyledText should probably throw an error, since I don't think there are actual use cases for it.

","upvoteCount":1,"url":"https://github.com/brechtm/rinohtype/discussions/412#discussioncomment-6075212"}}}

Implementing bold+italics inline / how to pass class information for inline elements to rinohtype #412

Answered by brechtm
th0mr asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by th0mr
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants