Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
function loadPrismLang(lang) {
if (!lang) return undefined;
let langObject = Prism.languages[lang];
if (langObject === undefined) {
loadLanguages([lang]);
langObject = Prism.languages[lang];
}
return langObject;
}
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;