Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code block styling issue within a list item for apple theme #1177

Closed
hongrich opened this issue Apr 15, 2020 · 1 comment · Fixed by #1206
Closed

Code block styling issue within a list item for apple theme #1177

hongrich opened this issue Apr 15, 2020 · 1 comment · Fixed by #1206

Comments

@hongrich
Copy link

There appears to be a styling issue when code blocks are used within a list item in the default apple theme. Here is a screenshot that demonstrates this problem (I added two code blocks to the Realm documentation which uses the apple theme):

image

The first code block here is within a list item. The second code block is not within a list item. The second code block is styled properly, but there are some issues with the first code block. The first line is slightly more indented than the rest (class Dog doesn't line up with the closing curly brace) and many characters have their descenders clipped (you can see this in characters like g, j, p).


(Here is the same example in Github in case it's useful for reproducing the issue)
  • Building Realm documentation requires jazzy

    class Dog: Object {
        @objc dynamic var name: String = ""
        @objc dynamic var adopted: Bool = false
        let siblings = List<Dog>()
    }
class Dog: Object {
    @objc dynamic var name: String = ""
    @objc dynamic var adopted: Bool = false
    let siblings = List<Dog>()
}

One fix is to add the following styles:

pre > code {
  padding: 0;
}

I believe the problem is that the style intended for inline code blocks is too broad and unintentionally adds padding to code blocks within a list item as well.

p code, li code {
background-color: $code_bg_color;
padding: 2px 4px;
border-radius: 4px;
}

I did not test this in the other two themes but they also style code blocks differently, so it may not be an issue for those.

@johnfairh
Copy link
Collaborator

Thanks for opening this.

Tough to judge what the original intention was here: I agree the pre > code change is least likely to break something else.

The other themes look OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants