Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new rule: remark-lint-consistent-linebreaks #292

Closed
4 tasks done
remcohaszing opened this issue Jul 22, 2022 · 3 comments
Closed
4 tasks done

Add new rule: remark-lint-consistent-linebreaks #292

remcohaszing opened this issue Jul 22, 2022 · 3 comments
Labels
💪 phase/solved Post is done

Comments

@remcohaszing
Copy link
Member

Initial checklist

Problem

Commonmark supports two ways to add a linebreak.

Using two spaces at the end of a line:

foo··
bar

Using a backslash at the end of a line:

foo\
bar

It would be nice if remark could enforce consistency.

Solution

Add a new rule: remark-lint-consistent-linebreaks

This rule enforces one style or the other, defaulting to \.

Alternatives

People shouldn’t use line breaks in the first place, but since they do, let’s prefer the visible one over the invisible one 🤷

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jul 22, 2022
@wooorm
Copy link
Member

wooorm commented Jul 23, 2022

Good idea!
I think it should be called remark-lint-hard-break-style:

  • The word “hard break” is more often used to differentiate from a soft line break, it’s also used for the existing rule remark-lint-hard-break-spaces
  • linebreak is used for the existing rule remark-lint-linebreak-style, which checks for CRLF/LF
  • the word “consistent” is used in this project as an option, which means that the first used style is chosen, and later uses should be the same. This is typically the default.

I think it should have the options:

  • 'consistent' (default)
  • 'escape' (accepting e.g. a\(?:\r|\r\n|\n)b)
  • 'trailing' (accepting e.g. a␠␠(?:\r|\r\n|\n)b)

@wooorm wooorm added 🙆 yes/confirmed This is confirmed and ready to be worked on 👍 phase/yes Post is accepted and can be worked on labels Jul 23, 2022
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Jul 23, 2022
@github-actions

This comment has been minimized.

@wooorm
Copy link
Member

wooorm commented Jan 13, 2025

Oh this was 3817b19 btw. At some point I want to flip that option in a major, hard breaks can made with escapes are typically recommended!

@wooorm wooorm closed this as completed Jan 13, 2025
@wooorm wooorm added the 💪 phase/solved Post is done label Jan 13, 2025
@github-actions github-actions bot removed 👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on labels Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done
Development

No branches or pull requests

2 participants