chore: update mermaid to 11.9.0 (#8009)

Co-authored-by: ᴊᴏᴇ ᴄʜᴇɴ <jc@unknwon.io>
This commit is contained in:
Dmitry Afanasiev
2025-09-30 13:11:09 +03:00
committed by GitHub
parent 35c047dc9d
commit 6a6364bb5d
4 changed files with 2701 additions and 2031 deletions

View File

@@ -12,6 +12,7 @@ All notable changes to Gogs are documented in this file.
- The required Go version to compile source code changed to 1.24.
- The build tag `cert` has been removed, and the `gogs cert` subcommand is now always available. [#7883](https://github.com/gogs/gogs/pull/7883)
- Updated Mermaid JS to 11.9.0. [#8009](https://github.com/gogs/gogs/pull/8009)
### Fixed

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -59,10 +59,49 @@
<script src="{{AppSubURL}}/plugins/autosize-4.0.2/autosize.min.js"></script>
{{end}}
{{if .IsMarkdown}}
<script src="{{AppSubURL}}/plugins/mermaid-10.9.1/mermaid.min.js"></script>
<script src="{{AppSubURL}}/plugins/mermaid-11.9.0/mermaid.min.js"></script>
<script>
$(document).ready(function () {
mermaid.init({startOnLoad: true, noteMargin: 10}, ".language-mermaid");
const deepMerge = function(target, source) {
// Create a deep copy of the target to avoid modifying the original
const output = { ...target };
if (target && typeof target === 'object' && source && typeof source === 'object') {
for (const key in source) {
if (source.hasOwnProperty(key)) {
if (source[key] instanceof Object && target[key] instanceof Object) {
// If both are objects, recursively merge
output[key] = deepMerge(target[key], source[key]);
} else if (Array.isArray(source[key]) && Array.isArray(target[key])) {
// If both are arrays, concatenate them
output[key] = [...target[key], ...source[key]];
} else {
// Otherwise, overwrite with the source value
output[key] = source[key];
}
}
}
}
return output;
};
let initializeOpts = { startOnLoad: false, sequence: {noteMargin: 10}, journey: {noteMargin: 10}, timeline: {noteMargin: 10}, state: {noteMargin: 10} };
if (window.MERMAID_INITIALIZE_OPTIONS) {
// allow customization in inject/head.tmpl
initializeOpts = deepMerge(initializeOpts, window.MERMAID_INITIALIZE_OPTIONS);
}
mermaid.initialize(initializeOpts);
let runOpts = { querySelector: '.language-mermaid' };
if (window.MERMAID_RUN_OPTIONS) {
// allow customization in inject/head.tmpl
runOpts = deepMerge(runOpts, window.MERMAID_RUN_OPTIONS);
}
mermaid.run(runOpts);
});
</script>
{{end}}