Hacker News new | past | comments | ask | show | jobs | submit login

Put a space (or is it two?) in front of each line item if you want to make a list on HN. HN interprets this as 'code block' and doesn't reflow the text.



HN wraps things separated by blank lines in <p> tags, so:

  Line 1
  Line 2
becomes:

  <p>Line 1
  Line 2</p>
which displays as:

  Line 1 Line 2
If you want to make bullet lists on HN, you have to have a blank line separating each item.

Wrong Way:

  * Item 1
  * Item 2
  * Item 3
(unless you're aiming for this:

  <p>* Item 1
  * Item 2
  * Item 3</p>
)

Right Way:

  * Item 1

  * Item 2

  * Item 3
HTML:

  <p>* Item 1</p>

  <p>* Item 2</p>

  <p>* Item 3</p>
Renders as:

* Item 1

* Item 2

* Item 3

Some people use <pre> blocks (as I've been using above to show examples). This breaks on long lines, because there is no text wrapping (instead the element becomes horizontally scrollable). Like this:

  dfjgkhsfdlgkjdfgkjfdhldskfjghdkslfjghdflkjshdfglskdjfhglsdkjfhglsdfkjghsdlfkgjhsdflgjkhsdflgkjshdflgjkhsdfglkj
  afgkjhsdflgkjhdflgkjsdhfglskdjfhglsdfgksjdhfglsdjkfh
If you are editing your HN post in something like Vim or Emacs, you could wrap the text to N columns (something like 50 should probably be decent):

  - Lorem ipsum dolor sit amet, consectetur
    adipiscing elit. Nulla at lorem id eros
    tincidunt tempus. Fusce maximus efficitur
    tempus. Suspendisse auctor sem ligula, quis
    iaculis ante aliquam vel. Suspendisse potenti.
    Integer magna arcu, consequat laoreet nunc
    nec, pulvinar consequat justo. Cras sed velit
    sed odio ultrices ullamcorper. Suspendisse
    semper, urna ac vehicula vestibulum, mauris
    urna euismod velit, ac gravida mi purus sit
    amet mi. Sed commodo, turpis vel iaculis
    rutrum, justo nisi venenatis lacus, et pretium
    purus erat vel risus. Duis vulputate elit at
    orci auctor facilisis. Donec eu urna congue
    risus dapibus porta. Donec efficitur vel lorem
    sit amet fermentum. Suspendisse potenti.
    Aenean dictum, lorem non tristique commodo,
    nulla urna rutrum odio, sed sodales enim nisi
    eu tellus. Vivamus efficitur dictum est at
    laoreet. Sed ornare nulla in ante tincidunt,
    ac sagittis mi varius.
But you have to remember to "manually"[1] wrap the text yourself.

[1] Manually in that something other than HN will have to wrap the text for you. You can either do it be hand, or put technology to work for you... just not HN technology.


Does anyone know why HN doesn't handle linebreaks correctly? I mean, I can't imagine that it's by accident, but I also can't imagine why anyone would do it on purpose.

If it did like HTML and completely ignored linebreaks as extraneous whitespace, that would at least be consistent; if it expanded single linebreaks to doubles, that would be enforcing a layout preference for inter-paragraph blank lines; but "ignore one linebreak, print two linebreaks normally" is just weird.


I guess ignoring single linebreaks prevents people from wrapping lines manually (happens surprisingly often on some forums), resulting in an annoying reading experience.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: