Open igalic opened 7 years ago
Seems like this might fit in with #51 as a typography rule.
Is there a way to achieve this with markdownlint today? This issue is a bit dated.
I think that’s what this custom rule does: https://github.com/JoshuaKGoldberg/sentences-per-line
There's also https://sembr.org/ these days, which formalizes what i'm asking for…!
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!
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
@Alexander-Serov ... and documentation here: https://github.com/DavidAnson/markdownlint-cli2#markdownlint-cli2jsonc
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.
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. 😄
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.
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
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?