Closed Andrew15-5 closed 7 months ago
The [
and ]
were converted to "\n\n"
. This works for caption: [...]
or similar, but not for highlight[...]
.
I changed it to ignore [
and ]
, but allow replacements for named arguments and seperators for arguments based on the function.
With the rules
{
"arguments": {
"caption": {
"before": "\n\n",
"after": "\n\n",
},
},
"function": {
"table": {
"after_argument": "\n",
},
},
}
The source
#table(
columns: 2,
[*Name:*], [*Test*],
[value], [test],
)
#figure(
caption: [wow],
"cool body",
)
This is #highlight[important].
is converted to
Name:
Test
value
test
wow
This is important.
So you provided an abstract overview. Looking into the code there is nothing even close to this. But changing this:
SyntaxKind::LeftBracket | SyntaxKind::RightBracket => {
output.add_encoded(node.text().into(), String::from("\n\n"));
},
to this:
SyntaxKind::LeftBracket | SyntaxKind::RightBracket => {
output.add_encoded(node.text().into(), String::from(""));
},
indeed removes the error. But this fix is only for one specific use case...
https://github.com/antonWetzel/typst-languagetool/commit/194682eeea4a4f0ef9836b4e36c674c4a203a24b#diff-d42cae02d6ab6561d7a3d9a4d5538b03cdb33e075dfe41a89e70fd8206d9eaabR183-L187
This changed the behaviour to the default case with output.add_markup(...)
, which is equalivent to output.add_encoded(..., "")
.
If the content in the [...]
is a seperate paragraph, with rules newlines can be inserted around the content.
Great now it doesn't show the error. Thanks.
Used 4d48a86 commit.