debian-mirror-gitlab/app/assets/javascripts/behaviors/markdown/render_gfm.js

22 lines
748 B
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import $ from 'jquery';
import syntaxHighlight from '~/syntax_highlight';
2018-03-17 18:26:18 +05:30
import renderMath from './render_math';
import renderMermaid from './render_mermaid';
2018-12-05 23:21:45 +05:30
import highlightCurrentUser from './highlight_current_user';
2019-02-15 15:39:39 +05:30
import initUserPopovers from '../../user_popovers';
2018-03-27 19:54:05 +05:30
2018-12-05 23:21:45 +05:30
// Render GitLab flavoured Markdown
2017-08-17 22:00:37 +05:30
//
2018-03-17 18:26:18 +05:30
// Delegates to syntax highlight and render math & mermaid diagrams.
2017-08-17 22:00:37 +05:30
//
2018-03-17 18:26:18 +05:30
$.fn.renderGFM = function renderGFM() {
syntaxHighlight(this.find('.js-syntax-highlight'));
renderMath(this.find('.js-render-math'));
renderMermaid(this.find('.js-render-mermaid'));
2018-12-05 23:21:45 +05:30
highlightCurrentUser(this.find('.gfm-project_member').get());
2019-02-15 15:39:39 +05:30
initUserPopovers(this.find('.gfm-project_member').get());
2018-03-17 18:26:18 +05:30
return this;
};
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
$(() => $('body').renderGFM());