Codimd: Markdown line breaks

Created on 7 Nov 2015  Â·  7Comments  Â·  Source: hackmdio/codimd

Hi,

When writing some markdown using hackmd there's only one thing that bothers me, it's the carriage return ==
behavior which is not supposed to happen.

Original markdown "spec" states:

When you do want to insert a <br /> break tag using Markdown, you end
a line with two or more spaces, then type return.

Yes, this takes a tad more effort to create a <br />, but a simplistic
“every line break is a <br />” rule wouldn’t work for Markdown.
Markdown’s email-style blockquoting and multi-paragraph list items work
best — and look better — when you format them with hard breaks.

I understand that this is a debatable behavior, maybe an option to select the behaviour could work.

Most helpful comment

Supported in 0.3.4 via YAML metadata.
Put below codes at the beginning of your note.

breaks: false
---

All 7 comments

Yes! you're totally right.

Line breaks are so convenient so I would keep it as default.
But for matching the spec and GitHub usage, I will provide a option for this.

Thanks again.

Supported in 0.3.4 via YAML metadata.
Put below codes at the beginning of your note.

breaks: false
---

Hi,
I think that the default behavior doesn't follow the Principle of Less Surprise, for users that just found CodiMD (which is great by the way) and are used to the way that most of Markdown editors and previewers deal with hard line breaks.

So, I think that the default should be reversed: if no Yaml metadata appears, line breaks should be treated as most of editors, so Markdown files produced with CodiMD don't characterize because most of them start with a Yaml medatada block containing only breaks: false and the ones that explicitly want the current behavior will start with Yaml metadata block breaks: true

If fact, I would suggest a system wide defaults behavior, so by default hard lines will be treated as true or false, according to that system setting, suiting the users expected behavior and could be changed on a per document case with the Yaml metadata block (which will be set to the opposite of the system wide default).

@offray may want to come along in [#codimd:matrix.org] and talk about details.

For now what I can tell is that we follow the [CommonMark standard] and this requires hard breaks. May we should add some configurable defaults for all meta options. But that's out of scope of this issue.

@SISheogorath Thanks for the invitation. See you in the matrix channel and yes, maybe the proper scope is making configurable defaults for all meta options.

Just wanted to link to where this shows in the official docs, in case it helps any later folks:
https://hackmd.io/s/features#YAML-Metadata

There is a CMD_DEFAULT_USE_HARD_BREAK env option(and defaultUseHardbreak for config) for setting break preference instance-wide after version 1.4.0.

Documentation for this: https://hackmd.io/s/codimd-configuration#User-Features

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nebukadneza picture Nebukadneza  Â·  3Comments

yaxu picture yaxu  Â·  4Comments

almereyda picture almereyda  Â·  4Comments

nitwhiz picture nitwhiz  Â·  4Comments

almereyda picture almereyda  Â·  4Comments