better support shortcodes, some ui bug fix, exampleSite shortcodes post added

This commit is contained in:
zzossig 2020-01-25 17:18:02 +09:00
parent 4cc3bc5d64
commit 2f70d5c928
12 changed files with 165 additions and 68 deletions

View File

@ -1033,8 +1033,8 @@ libraries:
### notice ### notice
```bash ```bash
{{< notice note >}} # note, info, tip, warning {{< notice success >}} # success, info, warning, error
A notice disclaimer success
{{< /notice >}} {{< /notice >}}
``` ```

View File

@ -1026,8 +1026,8 @@ You can add some config option parameters at data/flowchartjs.json
### notice ### notice
```bash ```bash
{{< notice note >}} # note, info, tip, warning {{< notice success >}} # success, info, warning, error
A notice disclaimer success
{{< /notice >}} {{< /notice >}}
``` ```

View File

@ -1,30 +1,32 @@
.alert { .alert {
padding: 0.5rem; padding: 0.75rem;
margin-bottom: 1rem; margin-bottom: 1rem;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 0.125rem; border-radius: 0.125rem;
&-info { @include themify($themes) {
background-color: #d7eef9; &-info {
border: 2px solid #b2def4; background-color: rgba(215, 238, 249, 0.4);
color: rgba(26, 128, 180, 0.9925); border-left: 5px solid #bbdefb;
} color: themed('dropdown-item-color');
}
&-success { &-success {
background-color: #d9efd6; background-color: rgba(217, 239, 214, 0.4);
border: 2px solid #bce3b5; border-left: 5px solid #c8e6c9;
color: rgba(70, 149, 57, 0.9925); color: themed('dropdown-item-color');
} }
&-warning { &-warning {
background-color: #fbf6e1; background-color: rgba(255, 249, 196, 0.4);
border: 2px solid #f6ecbe; border-left: 5px solid #ffeb3b;
color: rgba(180, 154, 26, 0.9925); color: themed('dropdown-item-color');
} }
&-danger { &-danger {
background-color: #f5dddd; background-color: rgba(245, 221, 221, 0.4);
border: 2px solid #ecbdbd; border-left: 5px solid #ffcdd2;
color: rgba(159, 46, 46, 0.9925); color: themed('dropdown-item-color');
}
} }
} }

View File

@ -2,10 +2,9 @@
position: relative; position: relative;
margin: 1.5rem 0; margin: 1.5rem 0;
border-radius: 0.25rem; border-radius: 0.25rem;
@include box-shadow(1px, 1px, 3px, 0, rgba(0, 0, 0, 0.125));
&__content { &__content {
padding: 0 18px; padding: 0 1.125rem;
overflow: hidden; overflow: hidden;
max-height: 0; max-height: 0;
border-bottom-left-radius: 0.25rem; border-bottom-left-radius: 0.25rem;
@ -13,6 +12,7 @@
@include transition(all, 0.2s, ease); @include transition(all, 0.2s, ease);
@include themify($themes) { @include themify($themes) {
border-top: 1px solid themed('content-box-border-color');
background-color: themed('toc-body-background-color'); background-color: themed('toc-body-background-color');
} }
@ -21,6 +21,10 @@
font-size: 15.2px; font-size: 15.2px;
margin: 0 0 0.525rem 2rem !important; margin: 0 0 0.525rem 2rem !important;
list-style-type: '📂 '; list-style-type: '📂 ';
&:first-child {
margin-top: 0.25rem !important;
}
li { li {
font-size: 14.4px; font-size: 14.4px;

View File

@ -4,66 +4,65 @@
border-radius: .125rem; border-radius: .125rem;
color: #fff; color: #fff;
padding: .3rem 0.5rem .3rem 2rem; padding: .3rem 0.5rem .3rem 2rem;
font-size: 0.9rem; font-size: 0.95rem;
&:first-child { &.warning {
&::before {
position: absolute;
top: -28.5px;
color: #fff;
content: '💡';
left: 10px;
}
&::after {
position: absolute;
top: -28.5px;
color: #fff;
left: 2rem;
}
}
&.info {
border-top: 30px solid #f1b37e; border-top: 30px solid #f1b37e;
background: #fefaf5; background: #fefaf5;
color: rgba(150, 90, 38, 0.995) !important; color: rgba(150, 90, 38, 0.995) !important;
&:first-child::after { &::before {
content: 'Info'; position: absolute;
content: '⚠️ Warning';
font-family: $title-font; font-family: $title-font;
top: -26.5px;
left: 0.4rem;
height: 100%;
} }
} }
&.warning { &.error {
border-top: 30px solid #d58181; border-top: 30px solid #d58181;
background: #fbeded; background: #fbeded;
color: rgba(132, 56, 56, 0.995) !important; color: rgba(132, 56, 56, 0.995) !important;
&:first-child::after { &::before {
content: 'Warning'; position: absolute;
content: '❌ Error';
font-family: $title-font; font-family: $title-font;
top: -26.5px;
left: 0.4rem;
height: 100%;
} }
} }
&.note { &.info {
border-top: 30px solid #6bb1e0; border-top: 30px solid #6bb1e0;
background: #e6f3fb; background: #e6f3fb;
color: rgba(47, 103, 141, 0.995) !important; color: rgba(47, 103, 141, 0.995) !important;
&:first-child::after { &::before {
content: 'Note'; position: absolute;
content: ' Info';
font-family: $title-font; font-family: $title-font;
top: -26.5px;
left: 0.4rem;
height: 100%;
} }
} }
&.tip { &.success {
border-top: 30px solid #84c578; border-top: 30px solid #84c578;
background: #e8f7e6; background: #e8f7e6;
color: rgba(72, 125, 63, 0.995) !important; color: rgba(72, 125, 63, 0.995) !important;
&:first-child::after { &::before {
content: 'Tip'; position: absolute;
content: '✔️ Success';
font-family: $title-font; font-family: $title-font;
top: -26.5px;
left: 0.4rem;
height: 100%;
} }
} }
} }

View File

@ -1,4 +1,4 @@
.navbar { .navbar {
margin: auto; margin: auto;
width: inherit; width: inherit;
max-width: inherit; max-width: inherit;
@ -26,6 +26,11 @@
} }
&__slide-down { &__slide-down {
svg {
margin: auto;
display: block;
}
@include themify($themes) { @include themify($themes) {
background-color: themed('navbar-background-color'); background-color: themed('navbar-background-color');
@include on-event { @include on-event {

View File

@ -66,9 +66,9 @@ $dark: (
toc-title-color: #90a4ae, toc-title-color: #90a4ae,
toc-vertical-line: #727072, toc-vertical-line: #727072,
toc-vertical-line-active: #FF6188, toc-vertical-line-active: #FF6188,
toc-header-background-color: lighten(#2D2A2E, 6%), toc-header-background-color: #403E41,
toc-header-background-color-hover: lighten(#2D2A2E, 4%), toc-header-background-color-hover: #424242,
toc-body-background-color: lighten(#2D2A2E, 2%), toc-body-background-color: #403E41,
search-placeholder-color: #727072, search-placeholder-color: #727072,
search-color: #FCFCFA, search-color: #FCFCFA,
search-icon-color: #727072, search-icon-color: #727072,

View File

@ -13,8 +13,8 @@ $hacker: (
dropdown-item-active-background-color: lighten(#151715, 12%), dropdown-item-active-background-color: lighten(#151715, 12%),
dropdown-content-background-color: lighten(#151715, 5%), dropdown-content-background-color: lighten(#151715, 5%),
dropdown-item-hover-background-color: lighten(#151715, 20%), dropdown-item-hover-background-color: lighten(#151715, 20%),
dropdown-item-hover-color: #FCFCFA, dropdown-item-hover-color: #E08C48,
dropdown-item-color: #e3cd26, dropdown-item-color: #CDF5CC,
navbar-border-bottom-color: #252526, navbar-border-bottom-color: #252526,
navbar-background-color: #252526, navbar-background-color: #252526,
navbar-mobile-background-color: #323232, navbar-mobile-background-color: #323232,

View File

@ -1,11 +1,11 @@
--- ---
title: "Shortcodes" title: "Shortcodes"
date: 2020-01-25T06:40:51+09:00 date: 2020-01-25T06:40:51+09:00
description: tabs, code-tabs, expand, alert, notice, img, box description: tabs, code-tabs, expand, alert, warning, notice, img, box
draft: false draft: false
hideToc: false hideToc: false
enableToc: true enableToc: true
enableTocContent: false enableTocContent: true
tocPosition: inner tocPosition: inner
tags: tags:
- shortcode - shortcode
@ -16,23 +16,42 @@ categories:
featured_image: feature3/code-file.png featured_image: feature3/code-file.png
--- ---
## Markdownify box
{{< boxmd >}}
This is **boxmd** shortcode
{{< /boxmd >}}
## Simple box
{{< box >}} {{< box >}}
Box This is **box** shortcode
{{< /box >}} {{< /box >}}
## Code tabs
Make it easy to switch between different code
{{< codes java javascript >}} {{< codes java javascript >}}
{{< code >}} {{< code >}}
```java ```java
System.out.println('Hello World!'); System.out.println('Hello World!');
``` ```
{{< /code >}} {{< /code >}}
{{< code >}} {{< code >}}
```javascript ```javascript
console.log('Hello World!'); console.log('Hello World!');
``` ```
{{< /code >}} {{< /code >}}
{{< /codes >}} {{< /codes >}}
## Tabs for general purpose
{{< tabs Windows MacOS Ubuntu >}} {{< tabs Windows MacOS Ubuntu >}}
{{< tab >}} {{< tab >}}
@ -42,6 +61,8 @@ Box
console.log('Hello World!'); console.log('Hello World!');
``` ```
Becareful that the content in the tab should be different from each other. The tab makes unique id hashes depending on the tab contents. So, If you just copy-paste the tabs with multiple times, since it has the same contents, the tab will not work.
{{< /tab >}} {{< /tab >}}
{{< tab >}} {{< tab >}}
@ -57,6 +78,28 @@ Box
{{< /tab >}} {{< /tab >}}
{{< /tabs >}} {{< /tabs >}}
## Expand
{{< expand "Expand me" >}}
### Title
contents
{{< /expand >}}
{{< expand "Expand me2" >}}
### Title2
contents2
{{< /expand >}}
## Alert
Colored box
{{< alert theme="warning" >}} {{< alert theme="warning" >}}
**this** is a text **this** is a text
{{< /alert >}} {{< /alert >}}
@ -73,4 +116,26 @@ Box
**this** is a text **this** is a text
{{< /alert >}} {{< /alert >}}
{{< img src="/images/whoami/avatar.jpg" title="title" caption="caption" alt="example avatar" width="400px" >}} ## Image
Diaplay image with title and caption
{{< img src="/images/whoami/avatar.jpg" title="Title" caption="example caption" alt="example avatar" width="400px" >}}
## Notice
{{< notice success >}}
success text
{{< /notice >}}
{{< notice info >}}
info text
{{< /notice >}}
{{< notice warning >}}
warning text
{{< /notice >}}
{{< notice error >}}
error text
{{< /notice >}}

View File

@ -194,8 +194,11 @@
var navbar = document.querySelector('.navbar'); var navbar = document.querySelector('.navbar');
var tocFlexbox = document.querySelector('.toc__flexbox'); var tocFlexbox = document.querySelector('.toc__flexbox');
var tocFlexboxOuter = document.querySelector('.toc__flexbox--outer'); var tocFlexboxOuter = document.querySelector('.toc__flexbox--outer');
var expandContents = document.querySelectorAll('.expand__content');
var boxContents = document.querySelectorAll('.box');
var notAllowedTitleIds = null; var notAllowedTitleIds = null;
// tab
singleContentsElem && singleContentsElem.querySelectorAll(".tab") ? singleContentsElem && singleContentsElem.querySelectorAll(".tab") ?
singleContentsElem.querySelectorAll(".tab").forEach(function (elem) { singleContentsElem.querySelectorAll(".tab").forEach(function (elem) {
elem.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(function (element) { elem.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(function (element) {
@ -204,6 +207,25 @@
[element.getAttribute('id')]; [element.getAttribute('id')];
}); });
}) : null; }) : null;
// expand
expandContents ? expandContents.forEach(function(elem) {
elem.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(function (element) {
notAllowedTitleIds = Array.isArray(notAllowedTitleIds) ?
notAllowedTitleIds.concat(element.getAttribute('id')) :
[element.getAttribute('id')];
});
}) : null;
// box
boxContents ? boxContents.forEach(function(elem) {
elem.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(function (element) {
notAllowedTitleIds = Array.isArray(notAllowedTitleIds) ?
notAllowedTitleIds.concat(element.getAttribute('id')) :
[element.getAttribute('id')];
});
}) : null;
window.onscroll = function () { window.onscroll = function () {
scrollFunction(); scrollFunction();

View File

@ -6,6 +6,6 @@
{{ .Get 0 }} {{ .Get 0 }}
</button> </button>
<div class="expand__content"> <div class="expand__content">
{{ .Inner | safeHTML }} {{ .Inner | markdownify }}
</div> </div>
</div> </div>