Closed why-jay closed 9 years ago
I’m not sure what use case you were referring to. I’m assuming regarding to mdast-lint-sentence-newline? I ran your example and it was ignored because HTML needs an extra black line after it:
The following is just two HTML blocks:
<!-- Invalid -->
Hello, world. This sentence should be on a second line.
<!-- Valid -->
Hello, world.
This sentence should be on a second line.
But this is HTML comments and text:
<!-- Invalid -->
Hello, world. This sentence should be on a second line.
<!-- Valid -->
Hello, world.
This sentence should be on a second line.
The last one is warned about about:
@wooorm Sorry for not being clearer - yes, I am talking about my custom rule. And, ah, I didn't know about the HTML comments thing, thanks. Just pushed a commit that fixes the example.
But there's another test case where what I mentioned above is still happening - let me come back with a test case to show you.
Fuck, I'm too tired - I'll ping you tomorrow. Thanks for your help.
Sure!
@wooorm I'm writing tests - can I get some more help? According to the mdast-lint
API doc, I'm supposed to use file.messages
inside the callback to #process()
. But on this line in my test suite, I keep getting undefined
for file.messages
:
https://github.com/chcokr/mdast-lint-sentence-newline/blob/master/test/test.js#L26
err, res, file
> err, file, res
. Did you get this from an example?
Ah, thanks! Yes, from here: https://github.com/wooorm/mdast-lint/blob/master/doc/api.md
Looks like it needs to be fixed over there!
on it
@wooorm Thanks, you the man.
Alright, so I just added my mysterious test case. It's actually not mysterious any more - I know why it's breaking. When there's a header, unist-util-visit
doesn't seem to visit the section's child text
nodes properly. Shouldn't it visit all text
nodes, even ones in children, when I do visit(ast, 'text')
?
https://github.com/chcokr/mdast-lint-sentence-newline/blob/master/test/header-body/file.md
Shouldn’t the done();
be outside visit
? Maybe that’s it?
Yup, changing that fixed your tests.
Ah, silly me! Closed via 4c302fdaf3feac625876d31ce5395320dd961204. Thank you so much for all your work - mdast
is very well maintained and I hope it gets even more attention and adoption. Is there any way to donate to your open-source efforts?
I've seen cases where the file.warn is reached but at the end of the linting I don't see any yellow warnings from this rule on the CLI.
@wooorm Could you do me a favor and see if there is more than what I did in the code in order to render a warning on the CLI?