Docs workaround for failing callback() section #1323
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📑 Summary
Under the
Flowchart > Interaction
section of the docs, the mermaid snippet for adding callback functions is not working as expected. Expected behavior is for a tooltip to appear on hover and for an alert to appear on click; neither of these behaviors are seen in the docs. In the original issue, I noted that the culprit may be due to the callback() function never being initialized.Resolves #1294
🐛 Related Bug Investigation
There were a few attempts to get this to work inside the document itself that did not result in successes:
docs/index.html
, I pasted thecallback()
function containing the alert. Running the docs locally, I was able to confirm that the function correctly initializes in console (result below). Clicking on the mermaid element still did not call that function.securityLevel:'loose'
to the mermaid init indocs/index.html
; I later also setstartOnLoad: true
. Neither, coupled with the exposed callback() function, resulted in any changes.executeScript: true
to thedocs/index.html
config: https://docsify.js.org/#/configuration?id=executescript However, this would only alleviate the issue of having to add all the callback functions from this doc page into thedocs/index.html
file.The root cause is one of two issues:
docs/index.html
.mermaid.initialize({});
conflicts with the callback functionality. The first option seems more likely due to only 3 fields being passed here with no obvious culprits.📏 Design Decisions
As a proposed workaround, I created a fiddle that uses mermaid 8.4.8 and runs the small callback demo, along with a note about these limitations. Screenshot of how this appears:
📋 Tasks
Make sure you
develop
branch