I tried creating an interactive sequence diagram inspired by https://observablehq.com/@tomlarkworthy/animated-sequence-diagrams
`
The (required) diagram is as shown below:
However when I am trying to animate it(in the observable notebook) I am encountering parse errors.
mermaid`sequenceDiagram
autonumber
actor S as Student
participant s as System
participant ad as Admin(Librarian)
participant b as Book database
participant sdb as Student database
${includeIf(
step > 0,
`${includeIf(step === 1, `rect rgb(0,255,0)\n`)}
S->>s: Login
activate S
activate s
${includeIf(step == 1, "\nend")}
${includeIf(
step > 1,
`${includeIf(step === 2, `rect rgb(0, 255, 0)\n`)}
s->>sdb: Authenticate with login details
activate sdb
${includeIf(step == 2, "\nend")}
${includeIf(
step > 2,`alt authenticated user
${includeIf(step === 3, `rect rgb(0, 255, 0)\n`)}
sdb-->>s: user authenticated
${includeIf(step == 3, "\nend")}
${includeIf(
step > 3,
`${includeIf(step === 4, `rect rgb(0, 255, 0)\n`)}
s-->>S: Login successful
${includeIf(step == 4, "\nend")}
${includeIf(
step > 4,`else else
${includeIf(step === 5, `rect rgb(0, 255, 0)\n`)}
sdb-->>s: authentication failed
${includeIf(step == 5, "\nend")}
${includeIf(
step > 5,
`${includeIf(step === 6, `rect rgb(0, 255,0)\n`)}
s->>sdb: does the user exist?
${includeIf(step == 6, "\nend")}
${includeIf(step > 6,
`alt user doesn't exist
${includeIf(step === 7, `rect rgb(0, 255,0)\n`)}
sdb-->>s: user does not exist
${includeIf(step == 7, "\nend")}
${includeIf(step > 7,
`${includeIf(step === 8, `rect rgb(0, 255,0)\n`)}
s->>S: Register?
${includeIf(step == 8, "\nend")}
${includeIf(step > 8,
`else else
${includeIf(step === 9, `rect rgb(0, 255,0)\n`)}
sdb-->>s: user already exists
deactivate sdb
${includeIf(step == 9, "\nend")}
${includeIf(step > 9,
`${includeIf(step === 10, `rect rgb(0,255,0)\n`)}
s->>S: invalid credentials
${includeIf(step == 10, "\nend")}
end
end`
)}`
)}`
)}`
)}`
)}`
)}`
)}`
)}`
)}`
)}
`
After observing closely I find that there needs to be an end statement immediately after an alt statementā¦but if I do so I would not get the required diagram.