Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.js « plugins « source_viewer « components « vue_shared « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5d24a3d110bbb2c7bcfa7d24d196b486c0f7702c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { HLJS_ON_AFTER_HIGHLIGHT } from '../constants';
import wrapComments from './wrap_comments';
import linkDependencies from './link_dependencies';

/**
 * Registers our plugins for Highlight.js
 *
 * Plugin API: https://github.com/highlightjs/highlight.js/blob/main/docs/plugin-api.rst
 *
 * @param {Object} hljs - the Highlight.js instance.
 */
export const registerPlugins = (hljs, fileType, rawContent) => {
  hljs.addPlugin({ [HLJS_ON_AFTER_HIGHLIGHT]: wrapComments });
  hljs.addPlugin({
    [HLJS_ON_AFTER_HIGHLIGHT]: (result) => linkDependencies(result, fileType, rawContent),
  });
};