src/vs/editor/common/languages/textToHtmlTokenizer.ts/_tokenizeToString
export function _tokenizeToString(text: string, languageIdCodec: ILanguageIdCodec, tokenizationSupport: IReducedTokenizationSupport): string {
	let result = `<div class="monaco-tokenized-source">`;
	const lines = strings.splitLines(text);
	let currentState = tokenizationSupport.getInitialState();
	for (let i = 0, len = lines.length; i < len; i++) {
		const line = lines[i];

		if (i > 0) {
			result += `<br/>`;
		}

		const tokenizationResult = tokenizationSupport.tokenizeEncoded(line, true, currentState);
		LineTokens.convertToEndOffset(tokenizationResult.tokens, line.length);
		const lineTokens = new LineTokens(tokenizationResult.tokens, line, languageIdCodec);
		const viewLineTokens = lineTokens.inflate();

		let startOffset = 0;
		for (let j = 0, lenJ = viewLineTokens.getCount(); j < lenJ; j++) {
			const type = viewLineTokens.getClassName(j);
			const endIndex = viewLineTokens.getEndOffset(j);
			result += `<span class="${type}">${strings.escape(line.substring(startOffset, endIndex))}</span>`;
			startOffset = endIndex;
		}

		currentState = tokenizationResult.endState;
	}

	result += `</div>`;
	return result;
}