-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
handle markdown files #37
Comments
Hey @drahnr, I investigated this issue a bit and as I see there are a bunch of todos in the code in regard of this issues. Which is really helpful. Here's one comment which I'd love to have a cast light on :) cargo-spellcheck/src/documentation.rs Lines 19 to 23 in a26aee1
It's no clear to me if you want reuse Mainly as I see to use the current structure the work should be piled on existent types such as Firstly I tried to extract And as I understand for getting literals out of markdown there must be used a Some thoughts out of my mind as I kinda stuck with that 😞 |
I'll write smth up in a few minutes - I have an idea how to solve this cleanly and also help making #18 testable as a sideeffect :) So the idea here is to make the the The first step is to introduce an enum like: #[derive(Debug,Clone,Hash,Eq,PartialEq)]
enum ContentSource {
CommonMarkFile(PathBuf),
RustDocTest(PathBuf, Span), // span is just there to disambiguiate
RustSourceFile(PathBuf),
} and use it with pub struct Documentation {
index: IndexMap<ContentSource, Vec<CheckableChunk>>,
} where struct CheckableChunk {
content: String,
source_lookup: IndexMap<Range,Span>
} (CC @KuabeM which is what I meant when I said, decouple from which is extracted from Does that make sense to you @zhiburt ? Note that I significantly underestimated the changes needed for this, so I am going to remove the good first issue tag, let me know if you still want to tackle it :) |
Please see #55 which includes most of what is needed :) feel free to pick it up from there, I left |
So #55 is complete and merged, feel free to take a shot or assign the issue back to me and I'll take over :) |
😄 I actually took a shot ones to implement it but didn't got too far 😞 I'll try to put it in action one more and tell how it will be. |
Got into frustration one more time 😄 cargo-spellcheck/src/traverse/mod.rs Line 357 in 06940a5
Adding an item such as below to the map allows to see the let mut source_mapping = IndexMap::new();
source_mapping.insert(
0..content.len(),
Span {
start: proc_macro2::LineColumn { line: 0, column: 0 },
end: proc_macro2::LineColumn { line: 0, column: 0 },
},
); So I can't figure out how to put it on the rails properly yet :( |
That would be roughly my approach too to just use a range / span covering the full markdown file. Did you fork the repo again? Lots changed and the Could you create a PR and add some comments on what particular thing / section you do not understand plus your current attempted changes, that would allow me to give you better directions :) |
It's not working properly 😞 but here it is |
You got pretty close, I wasn't sure so I implemented the surface part (almost the same as you did, take a look at e535f38 ) which is soon going to hit master soon - but I this was just the first step and there were plenty of other issues with that and actually required #25 to almost implemented - which was a bit of a heavy weight Don't get discouraged, I'll try to add some conceptual overview graphics so it's easier to understand the individual components better :) |
Summary
Enable handling of
*.md
files, the infrastructure is already there and the handling that is necessary is mostly intraverse.rs
and indocumentation.rs
The text was updated successfully, but these errors were encountered: