I originally posted a reply for how to style inline code that appears in a list item differently from inline code that is not in a list item (I misunderstood the question). I've included this description (minimized) below:
Applying different styles to inline code that only appears in a list item
Styling just inline code in list items
I've just opened a pull request that should make this possible without using internal CodeMirror CSS classes.
Until then, does the following work?
/* List items are 1) not headers and 2) have a <span class="tok-meta"></span> as a first child. */
.cm-line:not(.cm-header):has(:first-child.tok-meta) .cm-inlineCode {
/* Inline code in list item styles here */
}
Edit: For hiding the inline code border, see @dpoulton's suggestion above.
Styling list items
/* List items are:
1) not headers (:not(.cm-header))
2) not table delimters (:not(.cm-tableDelimiter))
3) and have a <span class="tok-meta"></span> as a first child. (:has(:first-child.tok-meta))
Note: This also applies to non-list paragraphs that start with bold or italic text.
*/
.cm-line:not(.cm-header):not(.cm-tableDelimiter):has(> :first-child.tok-meta) {
/* List item styles here */
color: #c2a674;
}
In the future, list item styling may be simplified by this pull request.
Edit summary: 1) Hid original solution 2) Linked to above answer for hiding inline-code border. 3) Added "styling list items" section. 4) Added note: CSS applies to non-list items.
But in my test, all inline codes now are formatted red, whether in a list item or not
/* List items are 1) not headers and 2) have a <span class="tok-meta"></span> as a first child. */
.cm-line:not(.cm-header):has(:first-child.tok-meta) .cm-inlineCode {
/* Inline code in list item styles here */
color: red;
}