-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Description
Describe the bug
When a formula notation (e.g., [$ 1+1=2]
) is followed immediately by a decoration notation with trailing spaces (e.g., [- [link] ]
), scrapbox-parser
incorrectly recognizes the entire sequence as a single formula node.
Cosense split them into a formula node and a decoration node as follows:
To Reproduce
Given the following code:
parse("[$ 1+1=2][. [link] ]", { hasTitle: false })
Expected Output
[
{
indent: 0,
type: "line",
nodes: [
{ type: "formula", raw: "[$ 1+1=2]", formula: "1+1=2" },
{
type: "decoration",
raw: "[- [link] ]",
rawDecos: "-",
decos: [ "-" ],
nodes: [
{
type: "link",
raw: "[link]",
pathType: "relative",
href: "link",
content: "",
},
{ type: "plain", raw: " ", text: " " }
]
}
]
}
]
Actual Output
[
{
indent: 0,
type: "line",
nodes: [
{
type: "formula",
raw: "[$ 1+1=2][- [link] ]",
formula: "1+1=2][- [link]"
}
]
}
]
Metadata
Metadata
Assignees
Labels
No labels