From a78a7884bec1131ffb807b1a3f9141b2d2e8b5b9 Mon Sep 17 00:00:00 2001 From: Dhruvi Sompura Date: Mon, 1 Dec 2025 16:52:31 -0800 Subject: [PATCH 1/5] Update block quote styling --- .../positronNotebook/browser/notebookCells/Markdown.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css b/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css index c72068217202..4a3d7e9684ff 100644 --- a/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css +++ b/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css @@ -125,10 +125,12 @@ } blockquote { - margin: 0 7px 0 5px; + margin: 0 7px 0 0; padding: 0 16px 0 10px; border-left-width: 5px; border-left-style: solid; + border-left-color: var(--vscode-textBlockQuote-border); + background-color: var(--vscode-textBlockQuote-background); } code { From b8539c870005c0d3f2c7b4fcc2209159778b2bd2 Mon Sep 17 00:00:00 2001 From: Dhruvi Sompura Date: Mon, 1 Dec 2025 17:15:01 -0800 Subject: [PATCH 2/5] Improve inline code styling --- .../positronNotebook/browser/notebookCells/Markdown.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css b/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css index 4a3d7e9684ff..6c6e8794ffe0 100644 --- a/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css +++ b/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css @@ -133,9 +133,13 @@ background-color: var(--vscode-textBlockQuote-background); } + /* inline code styling */ code { font-size: 1em; font-family: var(--vscode-repl-font-family); + background-color: var(--vscode-textPreformat-background); + padding: 1px 3px; + border-radius: 4px; } pre code { From d719b6ba2515193834b86937bdcee89e2ddd3b35 Mon Sep 17 00:00:00 2001 From: Dhruvi Sompura Date: Tue, 2 Dec 2025 13:36:42 -0800 Subject: [PATCH 3/5] Update code block styles --- .../contrib/positronNotebook/browser/markdownRenderer.ts | 5 ++++- .../positronNotebook/browser/notebookCells/Markdown.css | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/positronNotebook/browser/markdownRenderer.ts b/src/vs/workbench/contrib/positronNotebook/browser/markdownRenderer.ts index 05a86394987e..d0634ba2a87b 100644 --- a/src/vs/workbench/contrib/positronNotebook/browser/markdownRenderer.ts +++ b/src/vs/workbench/contrib/positronNotebook/browser/markdownRenderer.ts @@ -108,7 +108,10 @@ function markedHighlight(options: marked.MarkedOptions & { code({ text, lang, escaped }: marked.Tokens.Code) { const classAttr = lang ? ` class="language-${escape(lang)}"` : ''; text = text.replace(/\n$/, ''); - return `
${escaped ? text : escape(text)}\n
`; + // Note: We intentionally omit the trailing \n that marked-highlight includes. + // The \n is preserved by
's default white-space:pre behavior
+				// this causes visible whitespace at the bottom of code blocks in Positron notebooks.
+				return `
${escaped ? text : escape(text)}
`; }, }, }; diff --git a/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css b/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css index 6c6e8794ffe0..947bd416c0c7 100644 --- a/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css +++ b/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css @@ -142,10 +142,18 @@ border-radius: 4px; } + /** code block styling */ + pre { + background-color: var(--vscode-textCodeBlock-background); + padding: 16px; + border-radius: 4px; + } + pre code { line-height: 1.357em; white-space: pre-wrap; padding: 0; + background-color: transparent; /* override inline code style */ } li p { From 6b3ad1b0578ba295ccaa44be39328457e57491a8 Mon Sep 17 00:00:00 2001 From: Dhruvi Sompura Date: Wed, 3 Dec 2025 15:42:02 -0800 Subject: [PATCH 4/5] Prevent span elements in table html Prevent span elements from being created for each newline character in the html string returned by the markdown parser. These span elements should not exist in the table markup which is causing css rules to not work as expected. --- src/vs/base/common/htmlParser.ts | 56 ++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/src/vs/base/common/htmlParser.ts b/src/vs/base/common/htmlParser.ts index 138436afa179..96ca88aaab1e 100644 --- a/src/vs/base/common/htmlParser.ts +++ b/src/vs/base/common/htmlParser.ts @@ -84,6 +84,18 @@ const voidElements: Record = { 'wbr': true }; +/** + * Quick lookup table for table elements. + */ +const tableElements: Record = { + 'table': true, + 'thead': true, + 'tbody': true, + 'tfoot': true, + 'tr': true, + 'colgroup': true +}; + /** * Checks if a node is nested inside a
 element.
  * In 
 elements, whitespace must be preserved per HTML spec.
@@ -107,6 +119,19 @@ function isInsidePreElement(node: HtmlNode | undefined): boolean {
 	return false;
 }
 
+/**
+ * Checks if a node is a table elemen
+ *
+ * @param node The node to check (typically parent of a text node)
+ * @returns true if node is a table element
+ */
+function isTableElement(node: HtmlNode | undefined): boolean {
+	if (!node || !node.name) {
+		return false;
+	}
+	return tableElements[node.name] === true;
+}
+
 /**
  * Parses a single HTML tag.
  *
@@ -321,14 +346,22 @@ export function parseHtml(html: string): Array {
 				nextChar &&
 				nextChar !== '<'
 			) {
-				// This is a text node; add it as a child node
-				if (current.children === undefined) {
-					current.children = [];
+				const textContent = html.slice(start, html.indexOf('<', start));
+				const isWhitespace = whitespaceRE.test(textContent);
+				// Check if we are in a table element context with whitespace-only text node
+				const whitespaceInTable = isWhitespace && isTableElement(current);
+
+				// Don't add whitespace-only text nodes if they are inside table elements
+				if (!whitespaceInTable) {
+					// This is a text node; add it as a child node
+					if (current.children === undefined) {
+						current.children = [];
+					}
+					current.children.push({
+						type: 'text',
+						content: decode(textContent),
+					});
 				}
-				current.children.push({
-					type: 'text',
-					content: decode(html.slice(start, html.indexOf('<', start))),
-				});
 			}
 
 			// if we're at root, push new base node
@@ -383,11 +416,14 @@ export function parseHtml(html: string): Array {
 					content = ' ';
 				}
 
-				// Don't add whitespace-only text nodes if they would be trailing text nodes
-				// or if they would be leading whitespace-only text nodes:
+				// Check if we are in a table element context with whitespace-only text node
+				const whitespaceInTable = whitespaceRE.test(content) && isTableElement(current);
+
+				// Don't add whitespace-only text nodes if they would be: trailing text nodes
+				// leading whitespace-only text nodes, or inside table elements:
 				//  * end > -1 indicates this is not a trailing text node
 				//  * leading node is when level is -1 and parent has length 0
-				if ((end > -1 && level + parent.length >= 0) || content !== ' ') {
+				if (!whitespaceInTable && ((end > -1 && level + parent.length >= 0) || content !== ' ')) {
 					parent.push({
 						type: 'text',
 						parent: current,

From 80edd61210166f3b66d550e6fb2f06ebdecde8dc Mon Sep 17 00:00:00 2001
From: Dhruvi Sompura 
Date: Wed, 3 Dec 2025 16:22:39 -0800
Subject: [PATCH 5/5] Add spacing for multiple tables scenario

When there are multiple tables back to back the
edges are butted up against each other. We don't want table elements right up against other elements so we need to add some margin.
---
 .../contrib/positronNotebook/browser/notebookCells/Markdown.css  | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css b/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css
index 947bd416c0c7..e8e09ae8b35f 100644
--- a/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css
+++ b/src/vs/workbench/contrib/positronNotebook/browser/notebookCells/Markdown.css
@@ -101,6 +101,7 @@
 	table {
 		border-collapse: collapse;
 		border-spacing: 0;
+		margin-bottom: 0.7em;
 	}
 
 	table th,