Open fisherdarling opened 5 days ago
Harper actually is unwrapping the Markdown structs. In the case of inline code blocks, they're marked as Tokenkind::Unlintable
.It might be best to add a special case. If there is a "misspelled word" immediately after an unlintable token (without a space separating them), we may simply expand the unlintable token to include it.
Thoughts?
In my local tests of the lexer, I saw that the braces are converted into punctuation nodes.
So: Punctuation, Unlintable, Punctuation, Text('s')
. I think pulldown_cmark doesn't consider that a link, and therefore treats the braces as punctuation?
But in any case, that's an interesting idea. I was originally thinking of expanding on the markdown post processors to look for the pattern of [
, Unlintable
, ]
, non-space-text
. Then replace the tokens with Unlintable + non-space-text
.
I think you're advocating for doing that when a misspelled word is discovered. If we see a misspelled word, look at the previous tokens and try to construct a new word. That feels a bit less hacky than modifying the incoming token stream... I'll try to implement that first and see what it looks like.
Thanks!
I'm loving your thought process. Keep us updated on what you end up trying.
I'm calling a "link plural" a markdown structure in the form:
Where some link, with or without formatting, is followed by some other characters (usually a pluarl).
Right now, harper lints on the
s
as a separate entity (fromjust dogfood
).We should add some kind of unwrapping of markdown structs so that harper only sees
Spans
in the above and can properly lint on it.