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

style: sentence per line #66

Open
igalic opened this issue Jul 21, 2017 · 11 comments
Open

style: sentence per line #66

igalic opened this issue Jul 21, 2017 · 11 comments
Labels

Comments

@igalic
Copy link

igalic commented Jul 21, 2017

A lot of VCS backed writing guidelines state: One sentence per line.
A proper editor configuration can make any line-length easy enough on the eyes. But for being able to read a VCS history to a prose text, this style makes most sense.

Is there any way this could be supported?

@DavidAnson
Copy link
Owner

Seems like this might fit in with #51 as a typography rule.

@andrewrynhard
Copy link

Is there a way to achieve this with markdownlint today? This issue is a bit dated.

@DavidAnson
Copy link
Owner

I think that’s what this custom rule does: https://github.com/JoshuaKGoldberg/sentences-per-line

@igalic
Copy link
Author

igalic commented Nov 7, 2019

There's also https://sembr.org/ these days, which formalizes what i'm asking for…!

@Alexander-Serov
Copy link

Alexander-Serov commented Jun 13, 2022

I think that’s what this custom rule does: https://github.com/JoshuaKGoldberg/sentences-per-line

I see this issue from 2017 is still open (😀), so I would like to ask a question.
I see a custom rule has been provided above that allows one to achieve the desired behavior.
But it is still unclear to me how this can be integrated into a pre-commit config.
I have tried to provide the --rule argument in the pre-commit config or to provide "rules" or "customRules" property in the .markdownlint.json, but this seems to have no effect: my sentences are still formatted densely in each paragraph. Could you tell me what am I missing? Is there also a list of all options that .markdownlint.json accepts? I haven't been able to find an exhaustive list.

To provide more details, this is the last config of the .markdownlint.json that I have tried:

{
  "default": true,
  "first-heading-h1": false,
  "hr-style": false,
  "line-length": false,
  "no-duplicate-heading": false,
  "no-inline-html": {
    "allowed_elements": ["br", "sup", "sub", "img", "script"]
  },
  "ol-prefix": false,
  "rules": [
    "https://github.com/JoshuaKGoldberg/sentences-per-line/blob/master/index.js"
  ]
}

The pre-commit option I have tried:

  - repo: https://github.com/DavidAnson/markdownlint-cli2
    rev: v0.2.0
    hooks:
      - id: markdownlint-cli2
        name: markdownlint-cli2
        description: "Checks the style of Markdown/CommonMark files."
        entry: markdownlint-cli2
        language: node
        types: [markdown]
        minimum_pre_commit_version: 0.15.0
        args:
          [
            --rules="https://github.com/JoshuaKGoldberg/sentences-per-line/blob/master/index.js",
          ]

But no luck.
Thanks!

@DavidAnson
Copy link
Owner

It looks like you mean to use .markdownlint-cli2.jsonc. Here's an example of how that is structured: https://github.com/DavidAnson/markdownlint-cli2/blob/main/test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc

@DavidAnson
Copy link
Owner

@aepfli
Copy link
Contributor

aepfli commented Feb 13, 2023

Although there is already https://github.com/JoshuaKGoldberg/sentences-per-line will there be a chance that this will get integrated into markdown-lint directly (mainly because we're using just the docker image from markdownlint-cli, and it is hard to integrate it without building an own docker-image)?

If yes, and if I have the okay from @JoshuaKGoldberg may I start integrating it into markdown-lint as an optional rule? I do see this requirement more and more often, and I think it would allow a lot of people to use that rule easier more.

I would also make the rule a little bit more configurable, eg. list-of-line-seperators, ignored-words, to make it easier and more flexible to be used, also for other languages, etc.

@JoshuaKGoldberg
Copy link
Contributor

Yes, please do! I'd love to not have to maintain sentences-per-line. Moving it into core has been on my todo list for ages but I just haven't had the time. 😄

@DavidAnson
Copy link
Owner

FYI, there are no optional rules built into the library. That may be a policy I have to change someday, but so far everything in the library is on by default. There is a slight caveat here for a couple of rules that are enabled but do nothing in their default configuration. That would be the easiest path here, although I feel kind of like the spirit of this rule belongs as part of the "line length" rule since the two seem mutually exclusive. Unfortunately, I don't think they integrate cleanly from a configuration point of view.

aepfli added a commit to aepfli/markdownlint that referenced this issue Feb 14, 2023
New configurable and fixable rule to fix ensure only one sentence
per line. It is configurable, what defines the ending of a
sentence as well as ignored words.

Additionally to the new rule, i adapted the logic to create the
yaml file, as it did not work properly with arrays.

Signed-off-by: Simon Schrottner <[email protected]>
aepfli added a commit to aepfli/markdownlint that referenced this issue Feb 14, 2023
New configurable and fixable rule to fix ensure only one sentence
per line. It is configurable, what defines the ending of a
sentence as well as ignored words.

Additionally to the new rule, i adapted the logic to create the
yaml file, as it did not work properly with arrays.

Signed-off-by: Simon Schrottner <[email protected]>
aepfli added a commit to aepfli/markdownlint that referenced this issue Feb 14, 2023
New configurable and fixable rule to fix ensure only one sentence
per line. It is configurable, what defines the ending of a
sentence as well as ignored words.

Additionally to the new rule, i adapted the logic to create the
yaml file, as it did not work properly with arrays.

Signed-off-by: Simon Schrottner <[email protected]>
@aepfli
Copy link
Contributor

aepfli commented Feb 14, 2023

I created a draft pull request (#719 )- where I just played around yesterday and covered many topics. I even added a naive "optional" proposal. I marked the PR as a draft because I don't have much experience with JavaScript/Typescript, and some changes might be controversial (the text for the documentation needs improvement). But I am curious to hear what you think about it. what I should not do, or do instead :)
looking forward to some feedback

aepfli added a commit to aepfli/markdownlint that referenced this issue Feb 21, 2023
New configurable and fixable rule to fix ensure only one sentence
per line. It is configurable, what defines the ending of a
sentence as well as ignored words.

Additionally to the new rule, i adapted the logic to create the
yaml file, as it did not work properly with arrays.

Signed-off-by: Simon Schrottner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants