How to use the prismjs/components/ function in prismjs

To help you get started, we’ve selected a few prismjs 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 ionic-team / capacitor / site / scripts / markdown-renderer.ts View on Github external
import marked from 'marked';
import Prism from 'prismjs';
import path from 'path';
import loadLanguages from 'prismjs/components/';
import { SiteStructureItem, MarkdownContent } from '../src/global/definitions';

const languages = ['tsx', 'bash', 'typescript', 'markup', 'css', 'json', 'diff'];
loadLanguages(languages);

export function findItem(siteStructureList: SiteStructureItem[], filePath: string): SiteStructureItem {
  for (const item of siteStructureList) {
    if (item.filePath === filePath) {
      return item;
    } else if (item.children && item.children.length > 0) {
      const foundItem = findItem(item.children, filePath);
      if (foundItem != null) {
        return foundItem;
      }
    }
  }
}

export function listFactory(renderer: marked.Renderer, metadataList: SiteStructureItem[]) {
  let lastItem: any = null;
github jGleitz / markdown-it-prism / index.js View on Github external
function loadPrismLang(lang) {
	if (!lang) return undefined;
	let langObject = Prism.languages[lang];
	if (langObject === undefined) {
		loadLanguages([lang]);
		langObject =  Prism.languages[lang];
	}
	return langObject;
}
github ionic-team / stencil-site / scripts / markdown-renderer.ts View on Github external
import marked from 'marked';
import Prism from 'prismjs';
import path from 'path';
import loadLanguages from 'prismjs/components/';
import { SiteStructureItem, MarkdownContent } from '../src/global/definitions';

const languages = ['tsx', 'bash', 'typescript', 'javascript','markup', 'css', 'json', 'diff'];
loadLanguages(languages);

export function findItem(siteStructureList: SiteStructureItem[], filePath: string): SiteStructureItem {
  for (const item of siteStructureList) {
    if (item.filePath === filePath) {
      return item;
    } else if (item.children && item.children.length > 0) {
      const foundItem = findItem(item.children, filePath);
      if (foundItem != null) {
        return foundItem;
      }
    }
  }
}

export function listFactory(renderer: marked.Renderer, metadataList: SiteStructureItem[]) {
  let lastItem: any = null;