-
Notifications
You must be signed in to change notification settings - Fork 394
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
lint: inconsistent fenced code block -
line indentation
#554
Comments
I would actually create a ticket on the Prettier's repo to be honest. For us it does not look very important to include special instructions. |
Closing this for now :) |
Good call, I started opening an issue at https://github.com/prettier/prettier/issues/new?template=formatting.md but in the process I discovered why this is happening! The blocks that don't get indented have repeated keys inside the YAML blocks so actually they're NOT valid YAML. Prettier tries to run the YAML linter inside, but simply fails to parse them with error message Should we be worried that some of our DVC-file aren't technically valid YAML @shcheklein ? More of a Q for the core repo but asking here anyway. cc @efiop |
there is a bug in docs - in the first example, third md5 from the top should not be indented at all. It's a top-level md5. |
reopening it to check the docs and linting for this bug |
Hmm I see. OK I fixed that in 5f13d5c but what about the other 2 examples I mentioned? Here's a playground for static/docs/get-started/connect-code-and-data.md. In this case it complaints that And in this playground for static/docs/tutorial/define-ml-pipeline.md quite simply since the block langauge is ```dvc (unknown to Prettier) it ignores it. I can fix that by making sure all YAML samples are in '''yaml language blocks. |
The first one should be like this: cmd: python src/prepare.py data/data.xml
deps:
- md5: b4801c88a83f3bf5024c19a942993a48
path: src/prepare.py
- md5: a304afb96060aad90176268345e10355
path: data/data.xml
md5: c3a73109be6c186b9d72e714bcedaddb
outs:
- cache: true
md5: 6836f797f3924fb46fcfd6b9f6aa6416.dir
metric: false
path: data/prepared
wdir: . or like this: cmd: python src/prepare.py data/data.xml
deps:
- md5: b4801c88a83f3bf5024c19a942993a48
path: src/prepare.py
- md5: a304afb96060aad90176268345e10355
path: data/data.xml
md5: c3a73109be6c186b9d72e714bcedaddb
outs:
- cache: true
md5: 6836f797f3924fb46fcfd6b9f6aa6416.dir
metric: false
path: data/prepared
wdir: . |
Great. Yeah, Prettier forces it into the 2nd form you provided. Fixed all in b5cd910 |
A problem after implementing #372 is that some lines inside md fenced code blocks starting with
-
get indented for unknown reasons by Prettier.E.g. by finding the regex
^- cache
in all files we can see that static/docs/commands-reference/commit.md has the unindented lines:However static/docs/commands-reference/add.md has them indented:
I don't see a clear pattern explaining this apparently erratic behavior but it's all over the docs.
Again, this i work of Prettier which has been run on all md files in #512. None of the DVC-file samples had indentation before
-
lines originally. We decided that the indentation was OK in #512 (comment) but the fact that it indents some and unindents others troubles me a little. Perhaps we should use<!-- prettier-ignore -->
s before all YAML code blocks after all?All these code samples are still valid YAML though so please just close this issue if the decision is to live with it and let
prettier
do whatever it wants 😋Originally reported partially as lint: don't indent fenced code block contents
The text was updated successfully, but these errors were encountered: