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

Gramma incorrectly handles inline code spans in markdown #50

Open
JohnForster opened this issue Jul 15, 2024 · 0 comments
Open

Gramma incorrectly handles inline code spans in markdown #50

JohnForster opened this issue Jul 15, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@JohnForster
Copy link

Describe the bug
When using inline codespans in markdown mode, eg:

"Navigate to `/path/to/file` in your directory"

Gramma incorrectly identifies a double space, ie. the one before and the one after the code span.

A similar error occurs with commas, eg:

"Does Go have arithmetic operators like `++`, `+=`, `*=` or `--`?"

It appears that Gramma is stripping the codespan from the string before analysis, without accounting for the fact that something else was there. See the sentence field in the result below.

To Reproduce
Minimal reproduction (NodeJS)

const gramma = require("gramma");

const options = {
  language: "en-GB",
  dictionary: ["npm", "gramma"],
  markdown: true,
};

const string = "Delete the `loginResult` variable.";

gramma.check(string, options).then((results) => console.log(results.matches));

Expected behavior
No errors should be found in this text.

Actual behaviour

[
  {
    message: 'It seems like there are too many consecutive spaces here.',
    shortMessage: '',
    replacements: [ [Object] ],
    offset: 10,
    length: 15,
    context: {
      text: 'Delete the `loginResult` variable.',
      offset: 10,
      length: 15
    },
    sentence: 'Delete the  variable.',
    type: { typeName: 'Other' },
    rule: {
      id: 'CONSECUTIVE_SPACES',
      subId: '1',
      sourceFile: 'grammar.xml',
      description: 'Two consecutive spaces',
      issueType: 'typographical',
      category: [Object],
      isPremium: false,
      confidence: 0.47
    },
    ignoreForIncompleteSentence: true,
    contextForSureMatch: -1,
    word: ' `loginResult` '
  }
]

Desktop (please complete the following information):

  • OS: MacOS
  • Gramma version: 1.6.0
@JohnForster JohnForster added the bug Something isn't working label Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants