Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import scss from "highlight.js/lib/languages/scss.js";
import stylus from "highlight.js/lib/languages/stylus.js";
import js from "highlight.js/lib/languages/javascript.js";
import ts from "highlight.js/lib/languages/typescript.js";
import json from "highlight.js/lib/languages/json.js";
import xml from "highlight.js/lib/languages/xml.js";
import md from "highlight.js/lib/languages/markdown.js";
import bash from "highlight.js/lib/languages/bash.js";
// CSS and friends
low.registerLanguage("css", css);
low.registerLanguage("less", less);
low.registerLanguage("scss", scss);
low.registerLanguage("stylus", stylus);
// JS and friends
low.registerLanguage("js", js);
low.registerLanguage("javascript", js);
low.registerLanguage("jsx", js);
low.registerLanguage("ts", ts);
low.registerLanguage("tsx", ts);
low.registerLanguage("typescript", ts);
low.registerLanguage("json", json);
// HTML and friends
low.registerLanguage("html", xml);
low.registerLanguage("xml", xml);
low.registerLanguage("md", md);
low.registerLanguage("markdown", md);
low.registerLanguage("stylus", stylus);
// JS and friends
low.registerLanguage("js", js);
low.registerLanguage("javascript", js);
low.registerLanguage("jsx", js);
low.registerLanguage("ts", ts);
low.registerLanguage("tsx", ts);
low.registerLanguage("typescript", ts);
low.registerLanguage("json", json);
// HTML and friends
low.registerLanguage("html", xml);
low.registerLanguage("xml", xml);
low.registerLanguage("md", md);
low.registerLanguage("markdown", md);
// (s)hell(ish)s
low.registerLanguage("bash", bash);
// Low.registerLanguage('shell', bash);
const languages = [
"css",
"less",
"scss",
"stylus",
"js",
"javascript",
"jsx",
"ts",
"tsx",
"typescript",
import json from "highlight.js/lib/languages/json.js";
import xml from "highlight.js/lib/languages/xml.js";
import md from "highlight.js/lib/languages/markdown.js";
import bash from "highlight.js/lib/languages/bash.js";
// CSS and friends
low.registerLanguage("css", css);
low.registerLanguage("less", less);
low.registerLanguage("scss", scss);
low.registerLanguage("stylus", stylus);
// JS and friends
low.registerLanguage("js", js);
low.registerLanguage("javascript", js);
low.registerLanguage("jsx", js);
low.registerLanguage("ts", ts);
low.registerLanguage("tsx", ts);
low.registerLanguage("typescript", ts);
low.registerLanguage("json", json);
// HTML and friends
low.registerLanguage("html", xml);
low.registerLanguage("xml", xml);
low.registerLanguage("md", md);
low.registerLanguage("markdown", md);
// (s)hell(ish)s
low.registerLanguage("bash", bash);
// Low.registerLanguage('shell', bash);
const hast = highlight(language, source);
return toElements(hast);
}
// Highlight configuration
// CSS and friends
low.registerLanguage('css', css);
low.registerLanguage('less', less);
low.registerLanguage('scss', scss);
low.registerLanguage('stylus', stylus);
// JS and friends
low.registerLanguage('js', js);
low.registerLanguage('javascript', js);
low.registerLanguage('jsx', js);
low.registerLanguage('ts', ts);
low.registerLanguage('tsx', ts);
low.registerLanguage('typescript', ts);
low.registerLanguage('json', json);
// HTML and friends
low.registerLanguage('html', xml);
low.registerLanguage('xml', xml);
low.registerLanguage('md', md);
low.registerLanguage('markdown', md);
// (s)hell(ish)s
low.registerLanguage('bash', bash);
// Low.registerLanguage('shell', bash);
const languages = ['css', 'less', 'scss', 'stylus', 'js', 'javascript', 'jsx', 'ts', 'tsx', 'typescript', 'json', 'html', 'xml', 'md', 'markdown', 'bash'];
}
// Highlight configuration
// CSS and friends
low.registerLanguage('css', css);
low.registerLanguage('less', less);
low.registerLanguage('scss', scss);
low.registerLanguage('stylus', stylus);
// JS and friends
low.registerLanguage('js', js);
low.registerLanguage('javascript', js);
low.registerLanguage('jsx', js);
low.registerLanguage('ts', ts);
low.registerLanguage('tsx', ts);
low.registerLanguage('typescript', ts);
low.registerLanguage('json', json);
// HTML and friends
low.registerLanguage('html', xml);
low.registerLanguage('xml', xml);
low.registerLanguage('md', md);
low.registerLanguage('markdown', md);
// (s)hell(ish)s
low.registerLanguage('bash', bash);
// Low.registerLanguage('shell', bash);
const languages = ['css', 'less', 'scss', 'stylus', 'js', 'javascript', 'jsx', 'ts', 'tsx', 'typescript', 'json', 'html', 'xml', 'md', 'markdown', 'bash'];
function highlight(language, source) {
import React, { Component } from 'react';
import low from 'lowlight/lib/core';
import { styles, mapWithDepth } from './lowlight';
low.registerLanguage('jsx', require('highlight.js/lib/languages/javascript'));
class Highlight extends Component {
prop: {
code: string,
language?: string,
style?: Object
};
static defaultProps = {
language: 'jsx',
style: {}
};
render (): void {
const { code, language, style } = this.props;
const codeTree = low.highlight(language, code);
import lowlight from 'lowlight/lib/core';
lowlight.registerLanguage('cpp', cpp);
lowlight.registerLanguage('cs', cs);
lowlight.registerLanguage('css', css);
lowlight.registerLanguage('fsharp', fsharp);
lowlight.registerLanguage('go', go);
lowlight.registerLanguage('haskell', haskell);
lowlight.registerLanguage('java', java);
lowlight.registerLanguage('javascript', javascript);
lowlight.registerLanguage('julia', julia);
lowlight.registerLanguage('xml', xml);
lowlight.registerLanguage('matlab', matlab);
lowlight.registerLanguage('php', php);
lowlight.registerLanguage('python', python);
lowlight.registerLanguage('r', r);
lowlight.registerLanguage('ruby', ruby);
lowlight.registerLanguage('scala', scala);
lowlight.registerLanguage('sql', sql);
lowlight.registerLanguage('yaml', yaml);
const styles = {
tomorrow,
tomorrowNight,
};
class Syntax extends Component {
shouldComponentUpdate(nextProps) {
const { language, theme, style, source } = this.props;
return (
import yaml from 'highlight.js/lib/languages/yaml';
import lowlight from 'lowlight/lib/core';
lowlight.registerLanguage('cpp', cpp);
lowlight.registerLanguage('cs', cs);
lowlight.registerLanguage('css', css);
lowlight.registerLanguage('fsharp', fsharp);
lowlight.registerLanguage('go', go);
lowlight.registerLanguage('haskell', haskell);
lowlight.registerLanguage('java', java);
lowlight.registerLanguage('javascript', javascript);
lowlight.registerLanguage('julia', julia);
lowlight.registerLanguage('xml', xml);
lowlight.registerLanguage('matlab', matlab);
lowlight.registerLanguage('php', php);
lowlight.registerLanguage('python', python);
lowlight.registerLanguage('r', r);
lowlight.registerLanguage('ruby', ruby);
lowlight.registerLanguage('scala', scala);
lowlight.registerLanguage('sql', sql);
lowlight.registerLanguage('yaml', yaml);
const styles = {
tomorrow,
tomorrowNight,
};
class Syntax extends Component {
shouldComponentUpdate(nextProps) {
const { language, theme, style, source } = this.props;
lowlight.registerLanguage('cpp', cpp);
lowlight.registerLanguage('cs', cs);
lowlight.registerLanguage('css', css);
lowlight.registerLanguage('fsharp', fsharp);
lowlight.registerLanguage('go', go);
lowlight.registerLanguage('haskell', haskell);
lowlight.registerLanguage('java', java);
lowlight.registerLanguage('javascript', javascript);
lowlight.registerLanguage('julia', julia);
lowlight.registerLanguage('xml', xml);
lowlight.registerLanguage('matlab', matlab);
lowlight.registerLanguage('php', php);
lowlight.registerLanguage('python', python);
lowlight.registerLanguage('r', r);
lowlight.registerLanguage('ruby', ruby);
lowlight.registerLanguage('scala', scala);
lowlight.registerLanguage('sql', sql);
lowlight.registerLanguage('yaml', yaml);
const styles = {
tomorrow,
tomorrowNight,
};
class Syntax extends Component {
shouldComponentUpdate(nextProps) {
const { language, theme, style, source } = this.props;
return (
nextProps.language !== language ||
nextProps.theme !== theme ||
import scala from 'highlight.js/lib/languages/scala';
import sql from 'highlight.js/lib/languages/sql';
import yaml from 'highlight.js/lib/languages/yaml';
import lowlight from 'lowlight/lib/core';
lowlight.registerLanguage('cpp', cpp);
lowlight.registerLanguage('cs', cs);
lowlight.registerLanguage('css', css);
lowlight.registerLanguage('fsharp', fsharp);
lowlight.registerLanguage('go', go);
lowlight.registerLanguage('haskell', haskell);
lowlight.registerLanguage('java', java);
lowlight.registerLanguage('javascript', javascript);
lowlight.registerLanguage('julia', julia);
lowlight.registerLanguage('xml', xml);
lowlight.registerLanguage('matlab', matlab);
lowlight.registerLanguage('php', php);
lowlight.registerLanguage('python', python);
lowlight.registerLanguage('r', r);
lowlight.registerLanguage('ruby', ruby);
lowlight.registerLanguage('scala', scala);
lowlight.registerLanguage('sql', sql);
lowlight.registerLanguage('yaml', yaml);
const styles = {
tomorrow,
tomorrowNight,
};
class Syntax extends Component {