Add mermaid JS renderer (#12334)

* Add mermaid JS renderer

For feature parity with GitLab. Tested in files, issues, wiki, editor.
arc-green only does an inversion because the renderer seems to like to
render white backgrounds on boxes.

Ref: https://github.com/go-gitea/gitea/issues/3340
Fixes: https://github.com/go-gitea/gitea/issues/12307

* add feature entry, switch to neutral theme, remove border

* add bindFunctions support

* remove unnecessary border-radius

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
silverwind 2020-07-27 08:24:09 +02:00 committed by GitHub
parent 46ef562a16
commit 4315e313d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 521 additions and 41 deletions

View file

@ -13,6 +13,7 @@ import initClipboard from './features/clipboard.js';
import initUserHeatmap from './features/userheatmap.js';
import initServiceWorker from './features/serviceworker.js';
import initMarkdownAnchors from './markdown/anchors.js';
import renderMarkdownContent from './markdown/content.js';
import attachTribute from './features/tribute.js';
import createDropzone from './features/dropzone.js';
import initTableSort from './features/tablesort.js';
@ -46,6 +47,7 @@ function initCommentPreviewTab($form) {
}, (data) => {
const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`);
$previewPanel.html(data);
renderMarkdownContent();
});
});
@ -75,6 +77,7 @@ function initEditPreviewTab($form) {
}, (data) => {
const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`);
$previewPanel.html(data);
renderMarkdownContent();
});
});
}
@ -1007,6 +1010,7 @@ async function initRepository() {
}
dz.emit('submit');
dz.emit('reload');
renderMarkdownContent();
});
});
} else {
@ -1347,6 +1351,7 @@ function initWikiForm() {
wiki: true
}, (data) => {
preview.innerHTML = `<div class="markdown ui segment">${data}</div>`;
renderMarkdownContent();
});
};
if (!simplemde.isSideBySideActive()) {
@ -2484,6 +2489,7 @@ $(document).ready(async () => {
initUserHeatmap(),
initServiceWorker(),
initNotificationCount(),
renderMarkdownContent(),
]);
});