Skip to content
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

Spelling error line numbers are incorrect when using HTML entities (or maybe Markdown tables?) #102

Open
austenstone opened this issue Sep 3, 2022 · 1 comment
Labels

Comments

@austenstone
Copy link

austenstone commented Sep 3, 2022

The line numbers are incorrect when using HTML entitys such as  .

test.md

| github‑token | Token to use to authorize. | ${{ github.token }} |
| file‑json | JSON file containing the list of files to check. | ${{ file-json }} |
| files‑changed | List of files to check. | ${{ files-changed }} |
spellchecker test.md --reports test.json
test.json
[
    {
        "data": {},
        "messages": [
            {
                "message": "`github‑token` is misspelt",
                "name": "test.md:1:3-1:15",
                "reason": "`github‑token` is misspelt",
                "line": 1,
                "column": 3,
                "location": {
                    "start": {
                        "line": 1,
                        "column": 3,
                        "offset": 2
                    },
                    "end": {
                        "line": 1,
                        "column": 15,
                        "offset": 14
                    }
                },
                "source": "retext-spell",
                "ruleId": "github-token",
                "file": "test.md",
                "fatal": false,
                "actual": "github‑token",
                "expected": [],
                "url": "https://github.com/retextjs/retext-spell#readme"
            },
            {
                "message": "`file‑json` is misspelt",
                "name": "test.md:1:72-1:81",
                "reason": "`file‑json` is misspelt",
                "line": 1,
                "column": 72,
                "location": {
                    "start": {
                        "line": 1,
                        "column": 72,
                        "offset": 71
                    },
                    "end": {
                        "line": 1,
                        "column": 81,
                        "offset": 80
                    }
                },
                "source": "retext-spell",
                "ruleId": "file-json",
                "file": "test.md",
                "fatal": false,
                "actual": "file‑json",
                "expected": [],
                "url": "https://github.com/retextjs/retext-spell#readme"
            },
            {
                "message": "`JSON` is misspelt; did you mean `JASON`, `JON`, `SON`?",
                "name": "test.md:1:84-2:2",
                "reason": "`JSON` is misspelt; did you mean `JASON`, `JON`, `SON`?",
                "line": 1,
                "column": 84,
                "location": {
                    "start": {
                        "line": 1,
                        "column": 84,
                        "offset": 83
                    },
                    "end": {
                        "line": 2,
                        "column": 2,
                        "offset": 87
                    }
                },
                "source": "retext-spell",
                "ruleId": "json",
                "file": "test.md",
                "fatal": false,
                "actual": "JSON",
                "expected": [
                    "JASON",
                    "JON",
                    "SON"
                ],
                "url": "https://github.com/retextjs/retext-spell#readme"
            },
            {
                "message": "`file-json` is misspelt",
                "name": "test.md:2:53-2:62",
                "reason": "`file-json` is misspelt",
                "line": 2,
                "column": 53,
                "location": {
                    "start": {
                        "line": 2,
                        "column": 53,
                        "offset": 138
                    },
                    "end": {
                        "line": 2,
                        "column": 62,
                        "offset": 147
                    }
                },
                "source": "retext-spell",
                "ruleId": "file-json",
                "file": "test.md",
                "fatal": false,
                "actual": "file-json",
                "expected": [],
                "url": "https://github.com/retextjs/retext-spell#readme"
            }
        ],
        "history": [
            "test.md"
        ],
        "cwd": "C:\\Users\\auste\\source\\spellchecker-cli-action-summary",
        "contents": "| github‑token | Token to use to authorize. | ${{ github.token }} |\r\n| file‑json | JSON file containing the list of files to check. | ${{ file-json }} |\r\n| files‑changed | List of files to check. | ${{ files-changed }} |",
        "value": "| github‑token | Token to use to authorize. | ${{ github.token }} |\r\n| file‑json | JSON file containing the list of files to check. | ${{ file-json }} |\r\n| files‑changed | List of files to check. | ${{ files-changed }} |\n"
    }
]
Result Word Line Start Line End Line Start Expected Line End Expected
github‑token 1 1 1 1
file‑json 1 1 2 2
JSON 1 2 2 2
file-json 2 2 2 2
@tbroadley
Copy link
Owner

Thank you for reporting this!

I won't have time to investigate this in the near future. Feel free to dig into it if you're interested.

I expect this is a problem with one of the libraries that Spellchecker CLI uses to spell-check Markdown files, namely remark, remark-retext, and retext-spell.

@tbroadley tbroadley added the bug label Oct 19, 2024
@tbroadley tbroadley changed the title HTML Entity Spelling error line numbers are incorrect when using HTML entities (or maybe Markdown tables?) Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants