How to use the refractor.register function in refractor

To help you get started, we’ve selected a few refractor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / addons-code-manager / src / refractor / index.tsx View on Github external
import refractor from 'refractor';

import text from './text-language';
import './prism.css';
import './prism.overrides.scss';

// This is needed to provide a fallback in `getLanguage()` when the mime type
// has no corresponding syntax highlighting language.

export default refractor;
github benawad / codeponder / packages / web / utils / highlightCode.ts View on Github external
const getHast = (code: string, lang: string): RefractorNode[] | null => {
  if (!lang) return null;
  if (!refractor.registered(lang)) {
    try {
    } catch (ex) {}
  if (refractor.registered(lang)) {
    return refractor.highlight(code, lang);
  return null;


Lightweight, robust, elegant virtual syntax highlighting using Prism

Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis