chanzuckerberg / napari-hub

Discover, install, and share napari plugins
MIT License
50 stars 18 forks source link

Line breaks on the napari hub different to github #418

Open neuromusic opened 2 years ago

neuromusic commented 2 years ago

Discussed in https://github.com/chanzuckerberg/napari-hub/discussions/378

Originally posted by **haesleinhuepf** January 4, 2022 Hi all, I just noticed that napari hub plugin pages deal with line breaks (between badges) differently compared to github. The layout does not look good on the hub: https://www.napari-hub.org/plugins/napari-skimage-regionprops ![image](https://user-images.githubusercontent.com/12660498/148036840-60dc5c39-060d-42df-a092-4d22cbe0e16b.png) https://github.com/haesleinhuepf/napari-skimage-regionprops ![image](https://user-images.githubusercontent.com/12660498/148036940-dd097997-1b74-4e3d-a67e-00168cb9a329.png) Also line breaks within markdown text shows on the hub like this: ![image](https://user-images.githubusercontent.com/12660498/148037330-2665a7b8-ccb9-4a43-b567-5b10d84ad002.png) and on github like that: ![image](https://user-images.githubusercontent.com/12660498/148037373-d3fd80f2-0d76-42fe-b013-b39656a8ce5c.png) Is this something we plugin developers should deal with or can this be fixed on hub side? Thanks! Best, Robert
neuromusic commented 2 years ago

This is a bug b/c the markdown spec indicates that line breaks in the source should not translate into line breaks in the HTML:

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line — a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.

The implication of the “one or more consecutive lines of text” rule is that Markdown supports “hard-wrapped” text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s “Convert Line Breaks” option) which translate every line break character in a paragraph into a
tag.

https://daringfireball.net/projects/markdown/syntax#p

neuromusic commented 2 years ago

after a dive with @liaprins-czi @kne42 & @codemonkey800, there's something else going on here... there are other plugins that use line breaks that aren't having this problem.

need to investigate the README more closely... maybe there are trailing white space? or carriage returns?

neuromusic commented 2 years ago

however if we want to be consistent with github, may need to investigate further how to support READMEs like this