antonWetzel / typst-languagetool

LanguageTool Integration for Typst for spell and grammer check
MIT License
37 stars 9 forks source link

Treat SmartQuote as text, not markup #3

Closed TheNeverK closed 1 year ago

TheNeverK commented 1 year ago

Hi, While trying out this tool I found that LanguageTool reported errors where there are none. For example don't results in EN_CONTRACTION_SPELLING and world's in POSSESSIVE_APOSTROPHE, both related to lack of an apostrophe in a word. Short investigation later I found that State::convert converts SyntaxKind::SmartQuote as markup, and ignores the apostrophe symbol. I've made this simple change, and it solves this problem, but I'm not sure if this is the best way, as I didn't really analyze how the code works. So if there's a better way, let me know.

Tested the change on this fragment, straight from typst tutorial:

Glaciers as the one shown in
@glaciers will cease to exist if
we don't take action soon!

#figure(
  image("glacier.jpg", width: 70%),
  caption: [
    _Glaciers_ form an important part
    of the earth's climate system.
  ],
) <glaciers>

Versions:

Also, thanks for the tool, it really helps :D

antonWetzel commented 1 year ago

Thanks for the contribution. The location is the right place for the change.