-
Notifications
You must be signed in to change notification settings - Fork 38
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
Ignore markdown regions with code hints #53
Comments
Are you spell checking raw Markdown or are you converting it to HTML and then checking the HTML? Often, I convert Markdown to HTML and then use CSS selectors to ignore code blocks and such. It is often easier for me to filter things in HTML. That is my general recommendation, but there are potentially other ways. PySpelling, which is used to filter the content, has a Markdown filter which basically converts the Markdown content to HTML. The HTML filter allows you to filter out tags with selectors. Granted, you must enable an extension to handle fenced code properly though as fenced code is not part of the spec (old school spec, I'm not sure about CommonMark). The shipped extension that handles Markdown uses Python Markdown, which is an old school Markdown parser (not a CommonMark parser). For me, that is more than sufficient for my needs as the documentation I am often parsing also uses Python Markdown when I publish the documentation. If CommonMark is a requirement, a 3rd party extension can surely be created . I can't really answer further without out knowing how you are attempting to spell check your Markdown. |
Thanks for the quick reply! I'm just diving into this extension and trying to get it to work - my repo is here: https://github.com/supernovae/documentation and the config is here: https://github.com/supernovae/documentation/blob/main/.github/config/.spellcheck.yml I noticed when the action is run, all of the code looks like its in |
@supernovae Okay, so a couple of things. I checked out the repo you pointed me at and attempted to run PySpelling. Now, just as an FYI, while I do follow this repo because it relies on PySpelling, I do not actually use this action. As I am very familiar with Python, I set up my own action directly using Python in my CI environments, I also am used to testing it locally as I am also the author of Pyspelling. So I do not use this action and the docker image wrapper it relies on. Not only that, I am the author of PySpelling, and am comfortable running it directly on my local machine to test and debug, which is what you are going to see below.
|
So, that is how to fix your issue with PySpelling. Why is the action not straight-up failing with the malformed YAML? That I do not know and maybe something that this action repo may need to look into. I assume that fixing the config will fix your issue, but I have not run your repo through the action in this repo. |
Let me rephrase, I'm not seeing any misspellings in HTML code blocks. I see that you have not enabled any fenced code extensions, so give me a minute. |
It must be converting the fenced code block into inline code blocks as you have no fenced extension enabled. But since inline code is ignored as well, it works just fine, so 🤷🏻 . |
The majority of the words failing are in a markdown ````code` block |
@supernovae Okay, there are a couple of things here. I zeroed out the wordlist, just as you said you were doing. I found no actual actual Now, I do not think I am running what you are running as your results mentioned I got no misspellings in <li>
<p>Use <code>kubectl</code> to apply the <code>bgd-app.yaml</code> file
<div class="highlight"><pre><span></span><code>kubectl apply -f documentation/modules/ROOT/examples/bgd-app/bgd-app.yaml
</code></pre></div>
>The bgd-app.yaml file defines several things, including the repo location for the <code>gitops-bgd-app</code> application<br>
<img alt="screenshot of bgd-app-yaml" src="./bgd-app-yaml.png" /></p>
</li> results
So the context reporting had a bug, which I fixed locally.
In short, I am not seeing it incorrectly parsing content within code blocks, though I did see some false reporting which I will have fixed in the next PySpelling. If yours is truly doing showing words in code blocks after specify that PySpelling should ignore them, there is something off in your config, but I cannot verify this as I don't think I'm even testing the same branch you are. Additonally, while I think Python Markdown may parse your Markdown "good enough" to spell check (after enabling a fenced code extension), I do see that it doesn't quite parse everything exactly right as it has some expecations regarding formatting that some parsers (like CommonMark parsers) do not. I won't comment further on this as it appers to do well enough to avoid code blocks and such which appears to be the main concern. Based on your results vs mine, I still think you have a config issue. I see |
Reporting bug has been fixed and deployed |
So, it's been about a week. I figure you've solved this as I haven't seen any new info to help debug this further. I know this action is still using an older PySpelling, so once updated, it shouldn't see the wrong context for HTML elements. |
This is planned to be included in the upcoming 0.15.0 release. |
Thanks for the updates! Sorry, been busy with work. I look forward to trying this out and again, I really appreciate your help here! |
@byronmiller No worries. I was just following up to make sure there are no known bugs in PySpelling. These issues stay fresh in my mind for maybe a week (especially when they are filed on 3rd party repositories), then I'll forget about them unless I am pinged again 🙃. So, take your time. Hopefully, when you get back to this, the issue turns out to just be a config use issue. I've fixed the only issue I could find in PySpelling, and it was mainly cosmetic. |
Version 0.15.0 has just been uploaded to the marketplace |
Hi @supernovae I experienced a weird issue with release 0.15.0, so I mad a hotfix to patch the issue, so you should have a look at release 0.16.0 instead, |
Is it possible to tell spellcheck to ignore the markdown hinted areas for language?
For example, if I have
```bash
kubectl get nodes
```
Can it just not spellcheck that bash statement? I have lots of awscli or kubectl or curl commands and right now that means 800+ misspelled words
The text was updated successfully, but these errors were encountered: