Tweak code blocks

This commit is contained in:
Ryan Watters committed 2017-03-01 01:57:51 -06:00
1 parent c21fea827d
commit d0c7f01df8
10 files changed
+56 -82

No files matched your search

+3 -3
View File
@@ -27,10 +27,10 @@ In this context, *safe* means CSS content that matches any of the following:
Example: Given `style = "color: red;"` defined in the front matter of your `.md` file: Example: Given `style = "color: red;"` defined in the front matter of your `.md` file:
* `<p style="{{ .Params.style | safeCSS }}">…</p>` ⇒ `<p style="color: red;">…</p>` (Good!) * <span class="good">`<p style="{{ .Params.style | safeCSS }}">…</p>` &rarr; `<p style="color: red;">…</p>`</span>
* `<p style="{{ .Params.style }}">…</p>` ⇒ `<p style="ZgotmplZ">…</p>` (Bad!) * <span class="bad">`<p style="{{ .Params.style }}">…</p>` &rarr; `<p style="ZgotmplZ">…</p>`</span>
{{% note "ZgotmplZ" %}} {{% note "ZgotmplZ" %}}
ZgotmplZ is a special value that indicates that unsafe content reached a CSS or URL context. "ZgotmplZ" is a special value that indicates that unsafe content reached a CSS or URL context.
{{% /note %}} {{% /note %}}
+2 -2
View File
@@ -25,6 +25,6 @@ Template authors are responsible for ensuring that typed expressions do not brea
Example: Given `hash = "619c16f"` defined in the front matter of your `.md` file: Example: Given `hash = "619c16f"` defined in the front matter of your `.md` file:
* `<script>var form_{{ .Params.hash | safeJS }};…</script>` ⇒ `<script>var form_619c16f;…</script>` (Good!) * <span class="good">`<script>var form_{{ .Params.hash | safeJS }};…</script>` &rarr; `<script>var form_619c16f;…</script>`</span>
* `<script>var form_{{ .Params.hash }};…</script>` ⇒ `<script>var form_"619c16f";…</script>` (Bad!) * <span class="bad">`<script>var form_{{ .Params.hash }};…</script>` &rarr; `<script>var form_"619c16f";…</script>`</span>
@@ -11,6 +11,7 @@ weight: 50
draft: false draft: false
wip: true wip: true
aliases: [/overview/source-directory/] aliases: [/overview/source-directory/]
toc: true
--- ---
<!-- copied from old overview/source-directory --> <!-- copied from old overview/source-directory -->
+12
View File
@@ -90,6 +90,18 @@ When using the `define` keyword, you do *not* need to use Go templates context r
This replaces the contents of our (basically empty) "main" block with something useful for the list template. In this case, we didn't define a `"title"`` block, so the contents from our base template remain unchanged in lists. This replaces the contents of our (basically empty) "main" block with something useful for the list template. In this case, we didn't define a `"title"`` block, so the contents from our base template remain unchanged in lists.
{{% warning %}}
Code that you put outside the block definitions *can* break your layout. This even include HTML comments. For example:
```html
<!-- Here is a harmless comment..that will break my layout at build -->
{{ define "main" }}
...your code here
{{ end }}
```
[See this thread from the discussion forums](https://discuss.gohugo.io/t/baseof-html-block-templates-and-list-types-results-in-empty-pages/5612/6)
{{% /warning %}}
The following shows how you can override both the `"main"` and `"title"` block areas from the base template with code unique to your [default single page template][singletemplate]: The following shows how you can override both the `"main"` and `"title"` block areas from the base template with code unique to your [default single page template][singletemplate]:
{{% code file="layouts/_default/single.html" download="single.html" %}} {{% code file="layouts/_default/single.html" download="single.html" %}}
+1
View File
@@ -1,6 +1,7 @@
{{$icon := index (split (.Get "file") ".") 1 }} {{$icon := index (split (.Get "file") ".") 1 }}
<div class="code" id="{{.Get "file" | urlize}}"> <div class="code" id="{{.Get "file" | urlize}}">
{{- with .Get "file" -}} {{- with .Get "file" -}}
<div class="filename">{{.}}</div>
<div class="code-icon"> <div class="code-icon">
<i class="icon-{{$icon}} input"></i> <i class="icon-{{$icon}} input"></i>
</div> </div>
+2 -2
View File
@@ -23,7 +23,7 @@ $hugo-gold:#EBB951;
$hugo-gray:#737373; $hugo-gray:#737373;
$hugo-gray-dark:darken($hugo-gray, 10%); $hugo-gray-dark:darken($hugo-gray, 10%);
$hugo-gray-light:lighten($hugo-gray, 30%); $hugo-gray-light:lighten($hugo-gray, 30%);
$hugo-gray-ultra-light:lighten($hugo-gray-light, 23%); $hugo-gray-ultra-light:lighten($hugo-gray-light, 22%);
$hugo-green:#00A88A; $hugo-green:#00A88A;
$hugo-green-light:#33BA91; $hugo-green-light:#33BA91;
//Examples //Examples
@@ -67,7 +67,6 @@ $button-border-radius: .25em;
$code-tooltip-bg-color: $hugo-blue; $code-tooltip-bg-color: $hugo-blue;
$code-block-base-font-color: $hugo-black; $code-block-base-font-color: $hugo-black;
$code-block-background-color: darken($hugo-white,5%);
$code-editor-header-base-bg-color: $input-example-color; $code-editor-header-base-bg-color: $input-example-color;
$code-filename-color:#ffffff; $code-filename-color:#ffffff;
$code-copy-button-color:#ffffff; $code-copy-button-color:#ffffff;
@@ -75,6 +74,7 @@ $code-copy-button-text-color:$base-font-color;
$code-base-font-color:$hugo-pink-light; $code-base-font-color:$hugo-pink-light;
$inline-code-text-color:$base-font-color; $inline-code-text-color:$base-font-color;
$inline-code-background-color:$hugo-gray-ultra-light; $inline-code-background-color:$hugo-gray-ultra-light;
$code-block-background-color: $inline-code-background-color;
//Sidebar & Breadcrumb //Sidebar & Breadcrumb
$site-navigation-width: 280px; $site-navigation-width: 280px;
$content-max-width: 32em; $content-max-width: 32em;
+8 -57
View File
@@ -24,32 +24,6 @@
h2 { h2 {
display:none; display:none;
} }
// h2 {
// font-size: 1.1em;
// color: lighten($base-font-color, 20%);
// width: 100%;
// display: block;
// margin: 0px;
// padding: 0px;
// margin-left: 0px;
// padding: 0px 12px;
// border: none;
// outline: none;
// border-bottom-width: 2px;
// border-bottom-style: solid;
// display: inline-block;
// width: auto;
// z-index: 20;
// code,
// pre {
// color: inherit;
// }
// em,strong {
// color:inherit;
// font-weight:inherit;
// }
// display:none;
// }
.admonition-content { .admonition-content {
display: block; display: block;
margin: 0px; margin: 0px;
@@ -60,6 +34,14 @@
p:last-child { p:last-child {
margin-bottom: 0px; margin-bottom: 0px;
} }
ul,ol {
&:last-child {
margin-bottom:0px;
}
&:last-child + p {
margin-top:1em;
}
}
} }
} }
@@ -69,24 +51,6 @@
#exclamation-icon { #exclamation-icon {
fill: $hugo-blue; fill: $hugo-blue;
} }
// &:before {
// content: '\f06a';
// color: inherit;
// font-family:'FontAwesome';
// padding:0px;
// color:$hugo-blue;
// background-color: desaturate(lighten($hugo-blue,61%),20%);
// // &::after {
// // content:'';
// // width: 2px;
// // height: 4px;
// // border:2px solid $hugo-blue;
// // }
// }
// // h2 {
// // border-bottom-color: $hugo-blue;
// // color: $hugo-blue;
// // }
} }
.warning { .warning {
@@ -95,17 +59,4 @@
#exclamation-icon { #exclamation-icon {
fill: $hugo-pink; fill: $hugo-pink;
} }
// &:before {
// content: '\e810';
// color: $hugo-pink;
// background-color: lighten($hugo-pink, 54%);
// }
// h2 {
// border-bottom-color: $hugo-pink;
// color: $hugo-pink;
// pre,
// code {
// color: $hugo-pink;
// }
// }
} }
+25 -17
View File
@@ -14,11 +14,22 @@ svg.svg-icon {
} }
//for template lookup yes/no/na (e.g., in single-page template [/templates/single-page-template/]) //for template lookup yes/no/na (e.g., in single-page template [/templates/single-page-template/])
span.yes {
code {
color: $hugo-white;
background-color: $hugo-green;
}
}
span.no { span.no {
code { code {
background-color: $hugo-pink; background-color: $hugo-pink;
color: $hugo-white; color: $hugo-white;
} }
}
span.no,
span.bad {
&:after { &:after {
display: inline-block; display: inline-block;
@include size(1em); @include size(1em);
@@ -30,6 +41,19 @@ span.no {
} }
} }
span.yes,
.good {
&:after {
display: inline-block;
@include size(1em);
font-family: 'FontAwesome';
content: '\f164';
color: $hugo-green;
margin-left: .5em;
font-size: 1.2em;
}
}
span.break { span.break {
position: relative; position: relative;
display: inline-block; display: inline-block;
@@ -46,7 +70,7 @@ span.break {
border-bottom: 1px solid black; border-bottom: 1px solid black;
border-top: 1px solid black; border-top: 1px solid black;
top: .666em; top: .666em;
width:140px; width: 140px;
} }
&:before { &:before {
right: 100%; right: 100%;
@@ -58,22 +82,6 @@ span.break {
} }
} }
span.yes {
code {
color: $hugo-white;
background-color: $hugo-green;
}
&:after {
display: inline-block;
@include size(1em);
font-family: 'FontAwesome';
content: '\f164';
color: $hugo-green;
margin-left: .5em;
font-size: 1.2em;
}
}
span.na { span.na {
code { code {
background-color: transparent; background-color: transparent;
+1
View File
@@ -21,6 +21,7 @@
span, span,
p, p,
dd, dd,
dt,
{ {
code { code {
background-color: $inline-code-background-color; background-color: $inline-code-background-color;
+1 -1
View File
@@ -1 +1 @@
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;box-sizing:content-box;border-radius:0px !important;outline:none}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}html,body{margin:0px;padding:0px;outline:none;border:none;font-size:18px;font-family:"Museo Sans","muli","Helvetica Neue","Helvetica","Roboto","Arial",sans-serif;color:#222;line-height:1.6;font-weight:300;overflow-x:hidden}body{font-size:93%;overflow-x:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}@media only screen and (min-width: 760px){body{font-size:97%}}@media only screen and (min-width: 960px){body{font-size:100%}}strong{font-weight:500;color:#222}p{margin-top:0px;margin-bottom:1.5em;line-height:1.6}@font-face{font-family:'fontello';src:url("/fonts/fontello/fontello.eot");src:url("/fonts/fontello/fontello.woff2") format("woff2"),url("/fonts/fontello/fontello.woff") format("woff"),url("/fonts/fontello/fontello.ttf") format("truetype"),url("/fonts/fontello/fontello.svg?78165468#fontello") format("svg");font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-alert:before{content:'\e810'}.icon-angle-double-right:before{content:'\f101'}.icon-attach:before{content:'\e820'}.icon-attention:before{content:'\e80f'}.icon-bash:before{content:'\e804'}.icon-bell:before{content:'\e80d'}.icon-cancel:before{content:'\e81e'}.icon-caution:before{content:'\e80f'}.icon-chrome:before{content:'\e841'}.icon-clipboard:before{content:'\e817'}.icon-code:before{content:'\f121'}.icon-cog-alt:before{content:'\e814'}.icon-css3:before{content:'\f13c'}.icon-docs:before{content:'\f15c'}.icon-download:before{content:'\e815'}.icon-facebook-official:before{content:'\f230'}.icon-firefox:before{content:'\e840'}.icon-flag:before{content:'\e813'}.icon-forum:before{content:'\f03d';margin-right:.3em}.icon-github:before{content:'\f09b'}.icon-gitter:before{content:'\e819'}.icon-go:before{content:'\e801'}.icon-golang:before{content:'\e801'}.icon-heart:before{content:'\e81d'}.icon-help:before{content:'\e81b'}.icon-home:before{content:'\e812'}.icon-html.input:before{content:'\e81f'}.icon-html5:before{content:'\e800'}.icon-html:before{content:'\e800'}.icon-hugo:before{content:'\e81f'}.icon-ie:before{content:'\e843'}.icon-info:before{content:'\e811'}.icon-instagram:before{content:'\f32d'}.icon-javascript:before{content:'\e802'}.icon-js:before{content:'\e802'}.icon-json:before{content:'\e81c'}.icon-link:before{content:'\e816'}.icon-linkedin:before{content:'\f30c'}.icon-love:before{content:'\e81d'}.icon-mail:before{content:'\e821'}.icon-markdown:before{content:'\e80e'}.icon-md:before{content:'\e80e'}.icon-note:before{content:'\e80d'}.icon-opera:before{content:'\e842'}.icon-pdf:before{content:'\f1c1'}.icon-pencil:before{content:'\e80c'}.icon-picture:before{content:'\eLine truncated /*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;box-sizing:content-box;border-radius:0px !important;outline:none}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}html,body{margin:0px;padding:0px;outline:none;border:none;font-size:18px;font-family:"Museo Sans","muli","Helvetica Neue","Helvetica","Roboto","Arial",sans-serif;color:#222;line-height:1.6;font-weight:300;overflow-x:hidden}body{font-size:93%;overflow-x:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}@media only screen and (min-width: 760px){body{font-size:97%}}@media only screen and (min-width: 960px){body{font-size:100%}}strong{font-weight:500;color:#222}p{margin-top:0px;margin-bottom:1.5em;line-height:1.6}@font-face{font-family:'fontello';src:url("/fonts/fontello/fontello.eot");src:url("/fonts/fontello/fontello.woff2") format("woff2"),url("/fonts/fontello/fontello.woff") format("woff"),url("/fonts/fontello/fontello.ttf") format("truetype"),url("/fonts/fontello/fontello.svg?78165468#fontello") format("svg");font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-alert:before{content:'\e810'}.icon-angle-double-right:before{content:'\f101'}.icon-attach:before{content:'\e820'}.icon-attention:before{content:'\e80f'}.icon-bash:before{content:'\e804'}.icon-bell:before{content:'\e80d'}.icon-cancel:before{content:'\e81e'}.icon-caution:before{content:'\e80f'}.icon-chrome:before{content:'\e841'}.icon-clipboard:before{content:'\e817'}.icon-code:before{content:'\f121'}.icon-cog-alt:before{content:'\e814'}.icon-css3:before{content:'\f13c'}.icon-docs:before{content:'\f15c'}.icon-download:before{content:'\e815'}.icon-facebook-official:before{content:'\f230'}.icon-firefox:before{content:'\e840'}.icon-flag:before{content:'\e813'}.icon-forum:before{content:'\f03d';margin-right:.3em}.icon-github:before{content:'\f09b'}.icon-gitter:before{content:'\e819'}.icon-go:before{content:'\e801'}.icon-golang:before{content:'\e801'}.icon-heart:before{content:'\e81d'}.icon-help:before{content:'\e81b'}.icon-home:before{content:'\e812'}.icon-html.input:before{content:'\e81f'}.icon-html5:before{content:'\e800'}.icon-html:before{content:'\e800'}.icon-hugo:before{content:'\e81f'}.icon-ie:before{content:'\e843'}.icon-info:before{content:'\e811'}.icon-instagram:before{content:'\f32d'}.icon-javascript:before{content:'\e802'}.icon-js:before{content:'\e802'}.icon-json:before{content:'\e81c'}.icon-link:before{content:'\e816'}.icon-linkedin:before{content:'\f30c'}.icon-love:before{content:'\e81d'}.icon-mail:before{content:'\e821'}.icon-markdown:before{content:'\e80e'}.icon-md:before{content:'\e80e'}.icon-note:before{content:'\e80d'}.icon-opera:before{content:'\e842'}.icon-pdf:before{content:'\f1c1'}.icon-pencil:before{content:'\e80c'}.icon-picture:before{content:'\eLine truncated