From 74e31cae1a6f7d75b5a64d3a9d0fa64262c2e35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Fri, 16 Jun 2023 22:29:35 +0200 Subject: [PATCH] syntaxhighlight: move everything closer together in highlight table lineno mode #569 --- static/css/ie.css | 4 +++ static/css/theme.css | 65 ++++++++++++++++++------------------------ static/css/variant.css | 4 +++ 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/static/css/ie.css b/static/css/ie.css index 3319f6c5d8..ee3f2fd04d 100644 --- a/static/css/ie.css +++ b/static/css/ie.css @@ -488,6 +488,10 @@ color: rgba( 0, 0, 0, 1 ); /* var(--CODE-BLOCK-color) */ } + div.highlight > div { + border-color: rgba( 216, 216, 216, 1 ); /* var(--CODE-BLOCK-BORDER-color) */ + } + table { background-color: rgba( 255, 255, 255, 1 ); /* var(--INTERNAL-MAIN-BG-color) */ } diff --git a/static/css/theme.css b/static/css/theme.css index 82531940d8..29d4c7bb70 100644 --- a/static/css/theme.css +++ b/static/css/theme.css @@ -666,20 +666,37 @@ pre code { white-space: inherit; } +/* we may have special treatment if highlight shortcode was used in table lineno mode */ +div.highlight > div{ + border-style: solid; + border-width: 1px; +} +/* disable selection for lineno cells */ +div.highlight > div td:first-child:not(:last-child){ + user-select: none; +} /* increase code column to full width if highlight shortcode was used in table lineno mode */ -div.highlight td:nth-child(2){ +div.highlight > div td:not(:first-child):last-child{ width: 100%; } - -/* remove border from lineno column if highlight shortcode was used in table lineno mode */ -div.highlight td > pre:not(.pre-code) { - border-bottom-right-radius: 0; - border-right-width: 0; - border-top-right-radius: 0; +/* remove border from row cells if highlight shortcode was used in table lineno mode */ +div.highlight > div td > pre { + border-width: 0; } -div.highlight td:nth-child(2) pre { - border-bottom-left-radius: 0; - border-top-left-radius: 0; +/* in case of table lineno mode we want to move each row closer together - besides the edges +this usually applies only to wrapfix tables but it doesn't hurt for non-wrapfix tables too */ +div.highlight > div tr:not(:first-child) pre{ + padding-top: 0; +} +div.highlight > div tr:not(:last-child) pre{ + padding-bottom: 0; +} +/* in case of table lineno mode we want to move each columns closer together on the inside */ +div.highlight > div td:first-child:not(:last-child) pre{ + padding-right: 0; +} +div.highlight > div td:not(:first-child):last-child pre{ + padding-left: 0; } hr { @@ -1976,34 +1993,8 @@ html[dir="rtl"] #sidebar ul.collapsible-menu > li > label > i.fa-chevron-right { } /* remove border from code block if single in tab */ -#body .tab-content-text > div.highlight.wrapfix:only-child tbody, +#body .tab-content-text > div.highlight:only-child > div, #body .tab-content-text > div.highlight:only-child pre, #body .tab-content-text > pre.pre-code:only-child{ border-width: 0; } -/* re-add border on code column if single in tab and highlight shortcode was used in table lineno mode */ -#body .tab-content-text > div.highlight:only-child td:nth-child(2) pre { - border-left-width: 1px; -} - -/* we may have special treatment if highlight shortcode was used in table lineno mode and -we want to apply feasible wrapping for long code lines instead of scrolling */ -div.highlight.wrapfix tbody{ - background-color: var(--INTERNAL-CODE-BLOCK-BG-color); - border: 1px solid var(--INTERNAL-CODE-BLOCK-BORDER-color); -} -div.highlight.wrapfix tbody tr:not(:first-child) pre{ - padding-top: 0; -} -div.highlight.wrapfix tbody tr:not(:last-child) pre{ - padding-bottom: 0; -} -div.highlight.wrapfix tbody td:first-child:not(last-child){ - user-select: none; -} -div.highlight.wrapfix tbody td:not(:first-child):last-child{ - border-left: 1px solid var(--INTERNAL-CODE-BLOCK-BORDER-color); -} -div.highlight.wrapfix tbody td pre{ - border: 0; -} diff --git a/static/css/variant.css b/static/css/variant.css index 4e1ac11e22..c3479c2cc8 100644 --- a/static/css/variant.css +++ b/static/css/variant.css @@ -238,6 +238,10 @@ pre { color: var(--INTERNAL-CODE-BLOCK-color); } +div.highlight > div { + border-color: var(--INTERNAL-CODE-BLOCK-BORDER-color); +} + table { background-color: var(--INTERNAL-MAIN-BG-color); }