antonWetzel / typst-languagetool

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

`MORFOLOGIK_RULE_EN_GB` warning in the middle of words #28

Closed hbierlee closed 1 week ago

hbierlee commented 1 week ago

Hi,

Thanks for adding support for including multiple files recently. I've got most things working, but I have one distracting issue leading to a lot of false LanguageTool warnings. I've not been able to reproduce it in a simpler document unfortunately, but I thought I'd make an issue in case you've seen this before:

image

As you can see, there is a false warning for misspelling the latter part of minimal. Any idea what causes this?

The document is failry complex, with hundreds of paragraph chunks being sent to LanguageTool. I first thought it could be that it's chunking in-between "mini" and "mal".

I have another issue (feature request), which is to skip math blocks. I'll open another issue for that.

Cheers,

Henk

antonWetzel commented 1 week ago

The tool uses a seperate chunk for every page in the document, this looks like a wordbreak across pages. The suggested styling allows infinitely large pages and splits at section headers to try to minimize chunk errors.

...
// allow infinitely large pages
#set page(height: auto)

// split pages for headings up to the seperate-sections-level
#show heading: it => if it.level <= seperate-sections-level {
    pagebreak() + it
} else {
    it
}
...

If you use the special styling, you can use the overwrite: bool parameter to see the spellchecked document in the preview/pdf.

hbierlee commented 1 week ago

Thank you, that fixes it. I currently have a very sane overview of problems. Perhaps the default lt function should have this strategy, and just pagebreak at every section, which works fine for me.