Skip to content

Commit e82bd8e

Browse files
committed
Bring over Mermaid support from Cesium Native
1 parent d177f26 commit e82bd8e

File tree

6 files changed

+14749
-5
lines changed

6 files changed

+14749
-5
lines changed

Documentation/Assets/mermaid.min.js

+2,314
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Documentation/Assets/mingcute.json.js

+12,323
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Documentation/Assets/panzoom.js

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Documentation/Doxyfile

+8-4
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ TAB_SIZE = 4
283283
# with the commands \{ and \} for these it is advised to use the version @{ and
284284
# @} or use a double escape (\\{ and \\})
285285

286-
ALIASES =
286+
ALIASES = mermaid{1}="\htmlonly <div class=\"mermaid\"> \endhtmlonly \htmlinclude \"\1.mmd\" \htmlonly </div> \endhtmlonly" \
287+
mermaid-interactive{1}="\htmlonly <div class=\"mermaid interactive\"> \endhtmlonly \htmlinclude \"\1.mmd\" \htmlonly </div> \endhtmlonly" \
288+
svg-interactive{2}="\htmlonly <div class=\"svg interactive\" style=\"min-height: \2\"> \endhtmlonly \image html \"\1.svg\" \htmlonly </div> \endhtmlonly"
287289

288290
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
289291
# only. Doxygen will then generate output that is more tailored for C. For
@@ -1077,7 +1079,7 @@ EXCLUDE_SYMBOLS = CesiumMetadataConversions<*
10771079
# that contain example code fragments that are included (see the \include
10781080
# command).
10791081

1080-
EXAMPLE_PATH =
1082+
EXAMPLE_PATH = ./Documentation/Diagrams
10811083

10821084
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
10831085
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -1367,7 +1369,7 @@ HTML_HEADER =
13671369
# that doxygen normally uses.
13681370
# This tag requires that the tag GENERATE_HTML is set to YES.
13691371

1370-
HTML_FOOTER =
1372+
HTML_FOOTER = ./Documentation/footer.html
13711373

13721374
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
13731375
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@@ -1407,7 +1409,9 @@ HTML_EXTRA_STYLESHEET = ./node_modules/doxygen-awesome-css/doxygen-awesome.css
14071409
# files will be copied as-is; there are no commands or markers available.
14081410
# This tag requires that the tag GENERATE_HTML is set to YES.
14091411

1410-
HTML_EXTRA_FILES =
1412+
HTML_EXTRA_FILES = ./Documentation/Assets/mermaid.min.js \
1413+
./Documentation/Assets/mingcute.json.js \
1414+
./Documentation/Assets/panzoom.js
14111415

14121416
# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
14131417
# should be rendered with a dark or light theme.

Documentation/developer-setup.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ There are detailed instructions for setting up a Cesium for Unreal development e
5656
- Run `npm install`
5757
- Run `npm run doxygen`
5858

59-
The reference documentation will be written to `Documentation/Reference`.
59+
The reference documentation will be written to `Documentation/Reference`.

Documentation/footer.html

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<script type="text/javascript" src="$relpath^mermaid.min.js"></script>
2+
<script type="text/javascript" src="$relpath^mingcute.json.js"></script>
3+
<script type="text/javascript" src="$relpath^panzoom.js"></script>
4+
<script type="text/javascript">
5+
let theme = "default";
6+
// Detect browser dark mode and use dark theme for Mermaid if enabled
7+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
8+
theme = "dark";
9+
}
10+
mermaid.initialize({
11+
theme: theme,
12+
startOnLoad: true,
13+
graph: {
14+
useMaxWidth: true
15+
}
16+
});
17+
mermaid.registerIconPacks([
18+
{
19+
name: "mingcute",
20+
loader: () => window.mingcute
21+
}
22+
]);
23+
window.addEventListener("load", (ev) => {
24+
document.querySelectorAll(".mermaid.interactive svg").forEach(svg => {
25+
svg.parentElement.style.overflow = "hidden";
26+
svg.parentElement.classList.add("pan-zoom-viewport");
27+
panzoom(svg);
28+
});
29+
document.querySelectorAll(".svg.interactive object[type='image/svg+xml']").forEach(svg => {
30+
// Make parent element the viewport
31+
svg.parentElement.style.overflow = "hidden";
32+
svg.parentElement.classList.add("pan-zoom-viewport");
33+
svg.parentElement.style.minHeight = svg.parentElement.parentElement.style.minHeight;
34+
panzoom(svg);
35+
});
36+
});
37+
</script>
38+
<style type="text/css">
39+
.pan-zoom-viewport {
40+
overflow: hidden;
41+
position: relative;
42+
border: 1px solid rgba(0, 0, 0, 0.4);
43+
padding-bottom: 30px;
44+
}
45+
46+
.pan-zoom-viewport::after {
47+
content: "Drag to move, scroll to zoom";
48+
color: rgba(0, 0, 0, 0.4);
49+
position: absolute;
50+
bottom: 5px;
51+
right: 10px;
52+
}
53+
54+
.pan-zoom-viewport svg {
55+
min-height: 150px;
56+
}
57+
</style>
58+
<!-- HTML footer for doxygen 1.9.1-->
59+
<!-- start footer part -->
60+
<!--BEGIN GENERATE_TREEVIEW-->
61+
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
62+
<ul>
63+
$navpath
64+
<li class="footer">$generatedby <a href="https://www.doxygen.org/index.html"><img class="footer"
65+
src="$relpath^doxygen.svg" width="104" height="31" alt="doxygen" /></a> $doxygenversion </li>
66+
</ul>
67+
</div>
68+
<!--END GENERATE_TREEVIEW-->
69+
<!--BEGIN !GENERATE_TREEVIEW-->
70+
<hr class="footer" />
71+
<address class="footer"><small>
72+
$generatedby&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="$relpath^doxygen.svg"
73+
width="104" height="31" alt="doxygen" /></a> $doxygenversion
74+
</small></address>
75+
</div><!-- doc-content -->
76+
<!--END !GENERATE_TREEVIEW-->
77+
</body>
78+
79+
</html>

0 commit comments

Comments
 (0)