From 7ce921d449d231b835156d1181cdf1983332529b Mon Sep 17 00:00:00 2001 From: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com> Date: Thu, 18 Apr 2019 14:57:26 -0700 Subject: [PATCH] Improve tabe markdown css (#5093) --- .../parts/notebook/cellViews/textCell.css | 34 ++++++++++++++++++- .../parts/notebook/notebookStyles.ts | 12 ++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/sql/workbench/parts/notebook/cellViews/textCell.css b/src/sql/workbench/parts/notebook/cellViews/textCell.css index aa789602fb..b49b743902 100644 --- a/src/sql/workbench/parts/notebook/cellViews/textCell.css +++ b/src/sql/workbench/parts/notebook/cellViews/textCell.css @@ -15,4 +15,36 @@ text-cell-component .notebook-preview { .notebook-preview.actionselect { user-select: text; -} \ No newline at end of file +} + +text-cell-component table { + border-collapse: collapse; + border-spacing: 0; + border: none; + font-size: 12px; + table-layout: auto; + margin-left: auto; + margin-right: auto; + margin-bottom: 1em; + display: table-row; + } + + text-cell-component thead { + vertical-align: bottom; + } + + text-cell-component td, + text-cell-component th, + text-cell-component tr { + text-align: left; + vertical-align: middle; + padding: 0.5em 0.5em; + line-height: normal; + white-space: normal; + max-width: none; + border: none; + } + + text-cell-component th { + font-weight: bold; + } \ No newline at end of file diff --git a/src/sql/workbench/parts/notebook/notebookStyles.ts b/src/sql/workbench/parts/notebook/notebookStyles.ts index bf16992651..0934ec3b01 100644 --- a/src/sql/workbench/parts/notebook/notebookStyles.ts +++ b/src/sql/workbench/parts/notebook/notebookStyles.ts @@ -6,7 +6,7 @@ import 'vs/css!./notebook'; import { registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService'; import { SIDE_BAR_BACKGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, EDITOR_GROUP_HEADER_TABS_BACKGROUND } from 'vs/workbench/common/theme'; -import { activeContrastBorder, contrastBorder, buttonBackground, textLinkForeground, editorBackground } from 'vs/platform/theme/common/colorRegistry'; +import { activeContrastBorder, contrastBorder, buttonBackground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry'; import { IDisposable } from 'vscode-xterm'; import { editorLineHighlight, editorLineHighlightBorder } from 'vs/editor/common/view/editorColorRegistry'; @@ -185,5 +185,15 @@ export function registerNotebookThemes(overrideEditorThemeSetting: boolean): IDi } `); } + + // Styling for tables in notebooks + const borderColor = theme.getColor(SIDE_BAR_BACKGROUND); + if (borderColor) { + collector.addRule(` + .notebookEditor text-cell-component tbody tr:nth-child(odd) { + background: ${borderColor}; + } + `); + } }); } \ No newline at end of file