Skip to content

Help Adding Color to an Individual Custom Code Block #8221

Discussion options

You must be logged in to vote

Hello @GreenTheBlaze,
you haven't provided the way you're creating the code block in your markdown file, how you're adding the style-good class.

Assuming you're doing it correctly, then with the highlight extension the special class gets added to a div wrapper as parent of the pre and code tags.

```lua { .style-good }
-- Without this condition, the aircraft hangar would fill up with water.
if waterLevelTooHigh() then
    drainHangar()
end
```

<div class="language-lua style-good highlight">

So your CSS should have a switcheroo in the rule:

.md-typeset .style-good * {
  color: green;
  font-weight: bold;
  margin-bottom: 0.25em;
}

/* Green background for code blocks with .style-good */
.md…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@GreenTheBlaze
Comment options

@GreenTheBlaze
Comment options

@kamilkrzyskow
Comment options

Answer selected by GreenTheBlaze
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