1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2025-01-12 14:12:13 +01:00

138 lines
3.8 KiB
SCSS
Raw Normal View History

2018-06-10 17:23:06 +02:00
////
/// Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
2018-06-10 17:23:06 +02:00
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
/// to deal in the Software without restriction, including without limitation
/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
/// and/or sell copies of the Software, and to permit persons to whom the
/// Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS
////
// ----------------------------------------------------------------------------
// Rules
// ----------------------------------------------------------------------------
// Scoped in typesetted content to match specificity of regular content
.md-typeset {
// Tabbed code block content
.tabbed-content {
2018-06-10 17:23:06 +02:00
display: none;
order: 99;
width: 100%;
overflow: auto;
background-color: var(--md-code-bg-color);
2018-06-10 17:23:06 +02:00
// Actual content
pre {
2018-06-10 17:23:06 +02:00
margin: 0;
border-radius: 0
}
}
// Tabbed code block container
.tabbed-set {
2018-06-10 17:23:06 +02:00
position: relative;
display: flex;
2018-06-10 17:23:06 +02:00
flex-wrap: wrap;
margin: 1em 0;
2020-02-25 20:25:05 +01:00
border: px2rem(1px) solid var(--md-default-fg-color--lightest);
border-radius: px2rem(2px);
2018-06-10 17:23:06 +02:00
// Hide radio buttons
> input {
2018-06-10 17:23:06 +02:00
display: none;
// Active tab label
&:checked + label {
color: var(--md-accent-fg-color);
border-color: var(--md-accent-fg-color);
2018-06-10 17:23:06 +02:00
// Show code tab content
& + .tabbed-content {
2018-06-10 17:23:06 +02:00
display: block;
padding: 0 px2rem(12px);
// Adjust spacing on last element
> :last-child {
margin-bottom: px2rem(12px);
}
2020-02-14 08:20:48 +01:00
// Emulate original pymdownx.superfences behavior and stretch to full
// width and height when a code block is the only child of a tab
> {
pre,
2020-02-14 08:20:48 +01:00
.highlight,
.highlighttable,
.codehilite,
.codehilitetable {
&:only-child {
margin: 0 px2rem(-12px);
// Remove double background
pre {
background: transparent;
}
}
}
}
2018-06-10 17:23:06 +02:00
}
}
}
// Tab label
> label {
2018-06-10 17:23:06 +02:00
width: auto;
padding: px2rem(12px);
padding-bottom: px2rem(10px);
color: var(--md-default-fg-color--light);
font-weight: 700;
font-size: ms(-1);
border-bottom: px2rem(2px) solid transparent;
2018-06-10 17:23:06 +02:00
cursor: pointer;
transition:
color 125ms,
border 250ms;
2018-06-10 17:23:06 +02:00
// Hovered tab label
html &:hover {
2020-02-25 20:25:05 +01:00
color: var(--md-accent-fg-color);
2018-06-10 17:23:06 +02:00
}
}
}
// Full-width container on top-level
> .tabbed-set {
2018-06-10 17:23:06 +02:00
// [mobile -]: Stretch to whole width
@include break-to-device(mobile) {
margin: 1em px2rem(-16px);
border: 0;
2020-02-25 20:25:05 +01:00
border-top: px2rem(1px) solid var(--md-default-fg-color--lightest);
2018-06-10 17:23:06 +02:00
border-radius: 0;
// Actual container with code, overflowing
code {
padding: px2rem(10.5px) px2rem(16px);
2018-06-10 17:23:06 +02:00
}
// First tab label
input:first-child + label {
margin-left: px2rem(4px);
}
2018-06-10 17:23:06 +02:00
}
}
}