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

Softbreaks in image's alt text are eaten #416

Closed yihui closed 1 year ago

yihui commented 1 year ago
  1. What version of goldmark are you using?

    1.5.6

  2. What version of Go are you using?

    1.20

  3. What operating system and processor architecture are you using?

    macOS 12.6.9 (Intel x86_64)

  4. What did you do?

    Convert this to HTML:

    ![alt
    text](logo.png)
  5. What did you expect to see? :

    <img src="logo.png" alt="alt
    text" />

    or even better:

    <img src="logo.png" alt="alt text" />
  6. What did you see instead?

    <img src="logo.png" alt="alttext" />

    Note that the line break was simply eaten, and the two words ended up being merged into one.

  7. Did you confirm your output is different from CommonMark online demo or other official renderer correspond with an extension?

    Yes, CommonMark's online demo would output

    <img src="logo.png" alt="alt
    text" />

    Not ideal, but better than no spaces or breaks at all.

Thanks for the great project!

yihui commented 1 year ago

Awesome. Thanks @yuin!