Open iherman opened 9 months ago
At the moment it seems to only work with data-include
.
<section data-include="mermaid.html"></section>
@sanderke I am not sure what you mean. Should I put the <figure>....</figure>
into a separate file and use a data include? I tried that (just now) and it did not work either.
Do you have an example file (or files) that you know work, so that I can try to work "backwards" to get what I want?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Verifiable Credentials Vocabulary v2.0</title>
<script class="remove" src="https://www.w3.org/Tools/respec/respec-w3c"></script>
<script class="remove" src="https://cdn.jsdelivr.net/gh/w3c/respec-mermaid@1.1.0/dist/main.js"></script>
<script class="remove">
var respecConfig = {
specStatus: "base",
shortName: "2018/credentials/",
thisVersion: "https://www.w3.org/2018/credentials/",
editors: [{
name: "Ivan Herman",
}],
postProcess: [window.respecMermaid.createFigures],
};
</script>
</head>
<body>
<section data-include="mermaid.html"></section>
</body>
</html>
<h2>Mermaid tests</h2>
<figure>
<pre class="diagram mermaid">
sequenceDiagram
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
Alice-)John: See you later!
</pre>
</figure>
Ah. That worked. I also realized why it did not on my earlier attempt: I forgot that data include only works in respec if the files are running through http(s). Ie, if I simply click on the HTML file on my machine to let the browser pick up the file, the include does not happen; I had to access the index.html via localhost and a server running on my machine.
Any plans to get rid of this constraints, ie, to allow an embedded mermaid instead of relying on data include?
To be on the safe side, I've put, below, the complete HTML+respec file that I used for testing.
The mermaid diagram does not always work; see what I get:
The mermaid itself is the example on readme, which does display in other mermaid environments (the mermaid.live playground, obsidian...).
Two interesting points:
Here is the exact HTML: