INNER CODE UNIT · TypeScript

activate

CloudWise-OpenSource/FlyFish · lcapCodeServer/linux/lib/vscode/extensions/markdown-language-features/notebook/index.ts:8

export function activate() {
	let markdownIt = new MarkdownIt({
		html: true
	});

	return {
		renderOutputItem: (outputInfo: { text(): string }, element: HTMLElement) => {
			const rendered = markdownIt.render(outputInfo.text());
			element.innerHTML = rendered;

			// Insert styles into markdown preview shadow dom so that they are applied
			for (const markdownStyleNode of document.getElementsByClassName('markdown-style')) {
				element.insertAdjacentElement('beforebegin', markdownStyleNode.cloneNode(true) as Element);
			}
		},
		extendMarkdownIt: (f: (md: typeof markdownIt) => void) => {
			f(markdownIt);
		}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…