swlkr / janetdocs

A community documentation site for the janet programming language
https://janetdocs.com
MIT License
34 stars 9 forks source link

In Firefox, multiline code snippet gets rendered on single line #1

Closed roobie closed 4 years ago

roobie commented 4 years ago

I added a repl session to show some examples of buffer/slice, and it seems like the lines are rendered on a single row:

image

I checked the html real quick, and the code is wrapped in a pre so I'm not sure why it looks like this.

roobie commented 4 years ago

The source text is this (retrieved from the textarea):

Example usage

```
janet:1:> (def buf @"ABCDE")
@"ABCDE"
janet:2:> (buffer/slice 0)
error: bad slot #0, expected string|symbol|keyword|buffer, got 0
  in buffer/slice
  in _thunk [repl] (tailcall) on line 2, column 1
janet:3:> (buffer/slice buf 0)
@"ABCDE"
janet:4:> (buffer/slice buf 0 1)
@"A"
janet:5:> (buffer/slice buf 0 -1)
@"ABCDE"
janet:6:> (buffer/slice buf 1 3)
@"BC"
```
swlkr commented 4 years ago

Oh interesting, I think it's a combination of moondown rendering the markdown and then and highlightjs highlighting it.

It seems to only happen when I try to use the three backticks, if I indent four spaces for code it doesn't happen. I'll have to see how I can get sundown to recognize three backticks instead of indentation

swlkr commented 4 years ago

No nevermind it was way simpler than that, just my bad styling choices:

pre > code p {
  line-height: 0; /* deleting this fixed it */
}

Of course the whole goal of that line was to stop it from having a crazy amount of padding, but maybe that's an actual markdown tweaking thing I should do

roobie commented 4 years ago

I can see that the issue is fixed. But yeah, I agree about the padding. I think the marked area in the image does not really correspond to the source text (that is, there's only one empty line between the "Example usage" and the code block.

image

But I'm closing this, as the issue is fixed.