antonWetzel / typst-languagetool

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

Changing paragraph leading from default causes every new line to be considered a new sentence #31

Open philher opened 2 weeks ago

philher commented 2 weeks ago

Changing leading from the default value of 0.65em causes each line in the rendered output to be considered a new sentence.

Issue observed using an external jar of Language Tool v6.4.

Current behaviour: image

Expected behaviour: image

MWE code:

#set text(lang: "en")
#set par(leading: 0.5em) // Comment this line to see the normal behaviour

Flowers have long been celebrated for their beauty and diversity, offering a vibrant tapestry of colours, shapes, and fragrances. From the delicate petals of a rose to the striking hues of orchids, each flower possesses its own unique charm that can captivate and inspire. The sheer variety found in the floral world means that there is a flower to suit every mood and occasion, whether it's the cheerful daffodil heralding spring or the elegant lily expressing sympathy and reverence.
antonWetzel commented 1 week ago

The tool checks the compiled document without looking at the source locations and therefore has to guesss if 2 lines in the document are connected. Because the line spacing is not known for the document the default 0.65em is hard-coded as the line spacing.

You can overwrite the spacing only for the spellcheck with somethin like this

#show: if sys.inputs.at("spellcheck", default: false) {
    // change settings
    (doc) => {
        set par(leading: 0.65em)
        doc
    }
} else {
    // do nothing
    (doc) => doc
}