yuin / goldmark

:trophy: A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.
MIT License
3.68k stars 255 forks source link

Missing newlines in the codeblock #149

Closed zerodayz closed 4 years ago

zerodayz commented 4 years ago

Please answer the following before submitting your issue:

  1. What version of goldmark are you using? : v1.2.1
  2. What version of Go are you using? : v1.14.3
  3. What operating system and processor architecture are you using? : darwin
  4. What did you do? :
    md := goldmark.New(
        goldmark.WithExtensions(
            extension.GFM,
            highlighting.NewHighlighting(
                highlighting.WithStyle("github"),
            ),
        ),
        goldmark.WithParserOptions(
            parser.WithAutoHeadingID(),
        ),
    )

    var buf bytes.Buffer

    md.Convert([]byte(s.Body), &buf)
    fmt.Println(buf.String())
\`\`\`bash
message
test
\`\`\`
  1. What did you expect to see? :

For some reason it does not recognize the line breaks. With Firefox I can see two lines on one line.

<pre style="background-color:#fff">message
<span style="color:#0086b3">test</span>
  1. What did you see instead? :
<pre style="background-color:#fff">message
<span style="color:#0086b3">test</span>
  1. Did you confirm your output is different from CommonMark online demo or other official renderer correspond with an extension?:

Yes

  1. (Feature request only): Why you can not implement it as an extension?:
    • You should avoid saying like "I'm not familiar with this project" "I'm not a Go programmer" as far as possible. This is an open source project and a library for Go programmers. I encourage you to strive to read source codes.
    • I absolutely welcome questions that are difficult even if you read the source codes.
zerodayz commented 4 years ago

Issue found in my own CSS. Sorry about that.

zerodayz commented 4 years ago

For anyone interested I had in pre element.

white-space: nowrap;