From 4a8adb8143a6785334d1bb94b264cd72f87443e8 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Mon, 16 Mar 2020 10:05:04 +0100 Subject: [PATCH] Corrected spacing for single code blocks in tabbed containers --- .../stylesheets/extensions/_codehilite.scss | 2 +- .../extensions/pymdown/_highlight.scss | 2 +- .../stylesheets/extensions/pymdown/_tabbed.scss | 17 ++++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/assets/stylesheets/extensions/_codehilite.scss b/src/assets/stylesheets/extensions/_codehilite.scss index bc4467636..f31565858 100644 --- a/src/assets/stylesheets/extensions/_codehilite.scss +++ b/src/assets/stylesheets/extensions/_codehilite.scss @@ -263,7 +263,7 @@ $codehilite-whitespace: transparent; .md-typeset { // Block with line numbers - > .codehilitetable { + .codehilitetable { margin: 1em 0; border-radius: px2rem(2px); diff --git a/src/assets/stylesheets/extensions/pymdown/_highlight.scss b/src/assets/stylesheets/extensions/pymdown/_highlight.scss index 660a90b0d..0521a0d6e 100644 --- a/src/assets/stylesheets/extensions/pymdown/_highlight.scss +++ b/src/assets/stylesheets/extensions/pymdown/_highlight.scss @@ -39,8 +39,8 @@ margin-left: px2em(-16px, 13.6px); padding-left: px2em(16px, 13.6px); float: left; - background-color: var(--md-code-bg-color); color: var(--md-default-fg-color--lighter); + background-color: var(--md-code-bg-color); box-shadow: inset px2rem(-1px) 0 var(--md-default-fg-color--lightest); content: attr(data-linenos); user-select: none; diff --git a/src/assets/stylesheets/extensions/pymdown/_tabbed.scss b/src/assets/stylesheets/extensions/pymdown/_tabbed.scss index 9c945f843..63092bb83 100644 --- a/src/assets/stylesheets/extensions/pymdown/_tabbed.scss +++ b/src/assets/stylesheets/extensions/pymdown/_tabbed.scss @@ -34,15 +34,18 @@ width: 100%; box-shadow: 0 px2rem(-1px) var(--md-default-fg-color--lightest); - // Actual content - pre { + // Mirror old superfences behavior, if there's only a single code block. + > .codehilite:only-child pre, + > .codehilitetable:only-child, + > .highlight:only-child pre, + > .highlighttable:only-child { margin: 0; - } - // Remove rounded borders at the top - code { - border-top-left-radius: 0; - border-top-right-radius: 0; + // Remove rounded borders at the top + > code { + border-top-left-radius: 0; + border-top-right-radius: 0; + } } // Nested tabs