Build Index


This describes the scripts/buildIndex.js logic which is used to help develop plugin views in browser mode.



We dynamically generate an index.html based on the passed in parameters. This lets us build an index for us within Plugin Core as well as NextJS Template

out = genVSCodeHTMLIndex;
write(public / index.html, out);
genVSCodeHTMLIndex(opts) {
	return `<html>

	// interpolate a bunch of values



onLoad {

applyTheme(theme) {
	window.currentTheme := theme

	// css link of new theme
	link := theme
	document.head.appendChild link


Copy and Paste

When copy and pasting content, Dendron has a listener that intercepts all copy events to apply additional formatting. This happens in ../packages/common-server/src/etc.ts (Private).

When a copy event is detected, Dendron creates two clipboard items:

  • plaintext
  • html

The plaintext clipboard item takes the raw plaintext.

The HTML clipboard item will strip out background color and other properties when copying HTML content (otherwise, pasting into Gmail will also paste in the extension background).