The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/views/root/hooks/useCodeHighlight.ts

19 lines
530 B

import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
import { register } from '../../../../app/markdown/lib/hljs';
export const useCodeHighlight = (): void => {
const codeHighlight = useSetting('Message_Code_highlight');
useEffect(() => {
if (typeof codeHighlight === 'string') {
codeHighlight.split(',').forEach((language: string) => {
const trimmedLanguage = language.trim();
if (trimmedLanguage) {
register(trimmedLanguage);
}
});
}
}, [codeHighlight]);
};