mkdocs-material/src/assets/stylesheets/extensions/_admonition.scss

114 lines
3.4 KiB
SCSS
Raw Normal View History

////
2017-01-06 21:11:18 +03:00
/// Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
///
/// 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
////
2016-01-29 01:27:15 +03:00
2016-09-04 18:32:12 +03:00
// ----------------------------------------------------------------------------
// Rules
2016-09-04 18:32:12 +03:00
// ----------------------------------------------------------------------------
2017-08-26 14:31:24 +03:00
// Scoped in typesetted content to match specificity of regular content
.md-typeset {
2017-08-26 14:31:24 +03:00
// Admonition extension
.admonition {
@include z-depth(2);
2017-08-26 14:31:24 +03:00
position: relative;
margin: 1.5625em 0;
padding: 0.8rem 1.2rem;
border-left: 0.4rem solid $clr-blue-a200;
border-radius: 0.2rem;
font-size: ms(-1);
2016-09-02 23:59:14 +03:00
2017-08-26 14:31:24 +03:00
// Remove spacing on first element
:first-child {
margin-top: 0;
}
2017-08-26 14:31:24 +03:00
// Remove spacing on last element
:last-child {
margin-bottom: 0;
}
2017-08-26 14:31:24 +03:00
// Title
.admonition-title {
margin: -0.8rem -1.2rem -0.4rem;
padding: 0.8rem 1.2rem;
border-bottom: 0.1rem solid transparentize($clr-blue-a200, 0.9);
background-color: transparentize($clr-blue-a200, 0.9);
font-weight: 700;
// Icon
&::before {
2017-08-26 14:31:24 +03:00
@extend %md-icon;
2017-08-26 14:31:24 +03:00
margin-right: 0.8rem;
color: $clr-blue-a200;
font-size: 2rem;
content: "edit";
vertical-align: -0.25em;
}
}
2017-08-26 14:31:24 +03:00
// Build representational classes
@each $names, $appearance in (
summary tldr: $clr-light-blue-a400 "subject",
tip hint important : $clr-teal-a700 "whatshot",
success check done: $clr-green-a700 "done",
warning caution attention: $clr-orange-a400 "warning",
failure fail missing: $clr-red-a200 "clear",
danger error: $clr-red-a400 "flash_on",
bug: $clr-pink-a400 "bug_report",
quote cite: $clr-grey "format_quote"
) {
$tint: nth($appearance, 1);
$icon: nth($appearance, 2);
2017-08-26 14:31:24 +03:00
// Define base class
&%#{nth($names, 1)},
&.#{nth($names, 1)} {
border-left: 0.4rem solid $tint;
// Title
.admonition-title {
border-bottom: 0.1rem solid transparentize($tint, 0.9);
background-color: transparentize($tint, 0.9);
2017-08-26 14:31:24 +03:00
// Icon
&::before {
color: $tint;
content: $icon;
}
}
}
// Define synonyms for base class
@if length($names) > 1 {
@for $n from 2 through length($names) {
&.#{nth($names, $n)} {
@extend .admonition%#{nth($names, 1)};
}
}
}
}
}
}