How to use the lowlight/lib/core.registerLanguage function in lowlight

To help you get started, we’ve selected a few lowlight 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 patternplate / patternplate / packages / client / src / app / components / common / code / highlight.js View on Github external
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);
github patternplate / patternplate / packages / client / src / app / components / common / code / highlight.js View on Github external
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",
github patternplate / patternplate / packages / client / src / app / components / common / code / highlight.js View on Github external
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);
github patternplate / patternplate / packages / components / lib / code / index.js View on Github external
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'];
github patternplate / patternplate / packages / components / lib / code / index.js View on Github external
}

// 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) {
github mohebifar / konsul / examples / src / components / konsul / CodeHighlight / Highlight.js View on Github external
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);
github FormidableLabs / spectacle-editor-viewer / src / components / syntax.js View on Github external
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 (
github FormidableLabs / spectacle-editor-viewer / src / components / syntax.js View on Github external
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;
github FormidableLabs / spectacle-editor-viewer / src / components / syntax.js View on Github external
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 ||
github FormidableLabs / spectacle-editor-viewer / src / components / syntax.js View on Github external
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 {