extensions/notebook-renderers/src/index.ts/renderStream
function renderStream(outputInfo: OutputItem, container: HTMLElement, error: boolean, ctx: RendererContext<void> & { readonly settings: { readonly lineLimit: number } }): void {
	const outputContainer = container.parentElement;
	if (!outputContainer) {
		// should never happen
		return;
	}

	const prev = outputContainer.previousSibling;
	if (prev) {
		// OutputItem in the same cell
		// check if the previous item is a stream
		const outputElement = (prev.firstChild as HTMLElement | null);
		if (outputElement && outputElement.getAttribute('output-mime-type') === outputInfo.mime) {
			// same stream
			const text = outputInfo.text();

			const element = document.createElement('span');
			truncatedArrayOfString(outputInfo.id, [text], ctx.settings.lineLimit, element);
			outputElement.appendChild(element);
			return;
		}
	}

	const element = document.createElement('span');
	element.classList.add('output-stream');

	const text = outputInfo.text();
	truncatedArrayOfString(outputInfo.id, [text], ctx.settings.lineLimit, element);
	while (container.firstChild) {
		container.removeChild(container.firstChild);
	}
	container.appendChild(element);
	container.setAttribute('output-mime-type', outputInfo.mime);
	if (error) {
		container.classList.add('error');
	}
}