Incase it's helpful for anyone else, I found that using a leading '.' in
the class declaration did the trick:

     :class: .myclass

This means that I can tweak the style of myclass while still maintaining
the defaults from the theme.


On Sunday, May 6, 2018, Chris Hughes <[email protected]>
wrote:

> Thanks for this, that helps.
>
> If I use, for example,
> .. literalinclude:: myfile
>      :class: myclass
>      :caption: ``fileExtensionPreference``
>      :name: lst:fileExtensionPreference
>
> then the style *myclass* overwrites the settings setup in my conf.py. Is
> there a way to have the settings of *myclass* appended to other settings?
>
> On Mon, Apr 30, 2018 at 10:01 PM, Aaron Carlisle <
> [email protected]> wrote:
>
>> I think you are looking for `:class:` which lets you add a custom
>> css class.
>>
>> On Mon, Apr 30, 2018 at 4:56 PM Chris Hughes <
>> [email protected]> wrote:
>>
>>> I'd like to start by thanking the team for sphinx, I find it a really
>>> helpful tool.
>>>
>>> Is there a way to style codeblocks and literalinclude on a per-instance
>>> basis? For example, given the following
>>>
>>>
>>> .. literalinclude:: myfile
>>>     :caption: ``fileExtensionPreference``
>>>     :name: lst:fileExtensionPreference
>>>
>>> is there a way to append this with something that would, for example,
>>> change the background colour for certain instances? Perhaps something like:
>>>
>>>
>>> .. literalinclude:: myfile
>>>     :caption: ``fileExtensionPreference``
>>>     :name: lst:fileExtensionPreference
>>>         :style:mystyle
>>>
>>>
>>> Similarly, for codeblocks, is there a way to style codeblocks such as
>>> the following?
>>>
>>>
>>> ::
>>>
>>>     mycommand goes here
>>>
>>>
>>> Note that I'd like to be able to do this for certain instances of
>>> literalinclude and ::, not on a global basis.
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/sphinx-users.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Aaron Carlisle
>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/sphinx-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to