Merge pull request #1 from chuxinh/chuxin-additions

This commit is contained in:
Jake Wiesler 2020-06-05 09:36:38 -04:00 committed by GitHub
commit 5008682d46
10 changed files with 2382 additions and 5 deletions

View File

@ -0,0 +1,130 @@
---
title: "Markdown Syntax Guide"
date: 2020-06-05
slug: "markdown-syntax-guide"
description: "Sample article showcasing basic Markdown syntax and formatting for HTML elements"
keywords: ["gohugo", "hugo", "go", "blog"]
draft: false
tags: ["markdown", "css", "html", "themes"]
stylesheet: "post.css"
---
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.
<!--more-->
## Headings
The following HTML `<h1>`—`<h6>` elements represent six levels of section headings. `<h1>` is the highest section level while `<h6>` is the lowest.
# H1
## H2
### H3
#### H4
##### H5
###### H6
## Paragraph
Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.
Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.
## Blockquotes
The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a `footer` or `cite` element, and optionally with in-line changes such as annotations and abbreviations.
#### Blockquote without attribution
> Tiam, ad mint andaepu dandae nostion secatur sequo quae.
> **Note** that you can use *Markdown syntax* within a blockquote.
## Tables
Tables aren't part of the core Markdown spec, but Hugo supports supports them out-of-the-box.
Name | Age
--------|------
Bob | 27
Alice | 23
#### Inline Markdown within tables
| Inline&nbsp;&nbsp;&nbsp; | Markdown&nbsp;&nbsp;&nbsp; | In&nbsp;&nbsp;&nbsp; | Table |
| ---------- | --------- | ----------------- | ---------- |
| *italics* | **bold** | ~~strikethrough~~&nbsp;&nbsp;&nbsp; | `code` |
## Code Blocks
#### Code block with backticks
```
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example HTML5 Document</title>
</head>
<body>
<p>Test</p>
</body>
</html>
```
#### Code block indented with four spaces
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example HTML5 Document</title>
</head>
<body>
<p>Test</p>
</body>
</html>
#### Code block with Hugo's internal highlight shortcode
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example HTML5 Document</title>
</head>
<body>
<p>Test</p>
</body>
</html>
```
## List Types
#### Ordered List
1. First item
2. Second item
3. Third item
#### Unordered List
* List item
* Another item
* And another item
#### Nested list
* Item
1. First Sub-item
2. Second Sub-item
## Other Elements — abbr, sub, sup, kbd, mark
<abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.
H<sub>2</sub>O
X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
Press <kbd><kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd></kbd> to end the session.
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.

View File

@ -0,0 +1,48 @@
---
title: "Math Typesetting"
date: 2020-06-05
slug: "math-typesetting"
description: "A brief guide to setup KaTeX"
keywords: ["gohugo", "hugo", "go", "blog"]
draft: false
tags: ["math"]
stylesheet: "post.css"
math: true
---
Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries.
<!--more-->
In this example we will be using [KaTeX](https://katex.org/)
- Create a partial under `/layouts/partials/math.html`
- Within this partial reference the [Auto-render Extension](https://katex.org/docs/autorender.html) or host these scripts locally.
- Include the partial in your templates like so:
```
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
```
- To enable KaTex globally set the parameter `math` to `true` in a project's configuration
- To enable KaTex on a per page basis include the parameter `math: true` in content files.
**Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html)
{{< math.inline >}}
{{ if or .Page.Params.math .Site.Params.math }}
<!-- KaTeX -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.css" integrity="sha384-dbVIfZGuN1Yq7/1Ocstc1lUEm+AT+/rCkibIcC/OmWo5f0EA48Vf8CytHzGrSwbQ" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.js" integrity="sha384-2BKqo+exmr9su6dir+qCw08N2ZKRucY4PrGQPPWU1A7FtlCGjmEGFqXCv5nyM5Ij" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
{{ end }}
{{</ math.inline >}}
### Examples
Inline math: $$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$
Block math:
$$
\sigma(t) = \cfrac{1}{1 + e^{-t}}
$$

View File

@ -0,0 +1,31 @@
---
title: "Rich Content"
date: 2020-06-05
slug: "rich-text"
description: "A brief description of Hugo Shortcodes"
keywords: ["gohugo", "hugo", "go", "blog"]
draft: false
tags: ["shortcodes"]
stylesheet: "post.css"
---
Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-management/shortcodes/#use-hugo-s-built-in-shortcodes) for rich content, along with a [Privacy Config](https://gohugo.io/about/hugo-and-gdpr/) and a set of Simple Shortcodes that enable static and no-JS versions of various social media embeds.
## Instagram Simple Shortcode
{{< instagram_simple BGvuInzyFAe hidecaption >}}
## YouTube Privacy Enhanced Shortcode
{{< youtube ZJthWmvUzzc >}}
## Twitter Simple Shortcode
{{< tweet 1085870671291310081 >}}
## Vimeo Simple Shortcode
{{< vimeo_simple 48912912 >}}

View File

@ -13,6 +13,9 @@
</header>
<article class="post__content">
{{ partial "anchored-headings.html" .Content }}
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
</article>
{{ partial "tags.html" .}} {{ partial "post-pagination.html" .}}
</div>

View File

@ -0,0 +1,11 @@
<!-- layouts/partials/math.html -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_SVG"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false, //disables context menu
tex2jax: {
inlineMath: [ ['$','$'], ['\\(','\\)'] ]
}
});
</script>

View File

@ -175,7 +175,7 @@ p.warning
footer
text-align: center
padding: 0 1.5rem
background: #F6F9FC
background: #ffffff
p
color: $grey

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,412 @@
button,button[type="button"],button[type="reset"],button[type="submit"]{-webkit-appearance:button}input,input[type=text],input[type=email]{-webkit-appearance:none;-moz-appearance:none;appearance:none}html,body{background-color:#fff;color:#111;height:100%}html{-webkit-box-sizing:border-box;box-sizing:border-box}*,*:before,*:after{padding:0;margin:0;-webkit-box-sizing:inherit;box-sizing:inherit}html{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;font-size:95%;}@media screen and (min-width:800px){html{font-size:100%}}@media screen and (min-width:1400px){html{font-size:115%}}h1,h2,h3,h4,h5,h6{margin-top:1.5rem;margin-bottom:0;line-height:1.5rem;}h1{font-size:2.121rem;line-height:2.25rem;margin-top:2.25rem}h2{font-size:1.414rem}h3{font-size:1.414/2rem}h4{font-size:1.414/3rem}h5{font-size:1.414/4rem}p{margin-top:1.5rem;margin-bottom:0;line-height:1.5rem}ul,ol{padding-left:1.5rem;margin-top:1.5rem;margin-bottom:1.5rem;}ul li,ol li{line-height:1.5rem}ul ul,ol ul,ul ol,ol ol{margin-top:0;margin-bottom:0}blockquote{margin-top:1.5rem;margin-bottom:1.5rem;line-height:1.5rem;color:#717171;font-style:italic}pre{line-height:1.45;margin-top:1.5rem;padding:16px;word-wrap:normal;overflow:auto;background-color:#f6f8fa;border-radius:3px}code{font-size:85%;font-family:"SFMono-Regular",Consolas,Menlo,monospace;padding:.2em .4em;margin:0;background-color:rgba(27,31,35,0.05);border-radius:3px}pre>code{word-break:normal;white-space:pre}pre code{display:inline;padding:0;margin:0;overflow:visible;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}.lead{font-size:1.414rem}.burger__container{height:4rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 1.5rem;position:fixed;width:100%;background:#fff;z-index:2;}@media screen and (min-width:800px){.burger__container{display:none}}.burger{position:relative;width:28px;height:28px;cursor:pointer}.burger__meat{position:absolute;width:28px;height:2px;background:#111;top:calc(50% - 2px / 2);left:calc(50% - 28px / 2);-webkit-transition:all 150ms ease-in;transition:all 150ms ease-in}.burger__meat--1{-webkit-transform:translateY(-10px);transform:translateY(-10px)}.burger__meat--2{width:calc(28px - 6px)}.burger__meat--3{-webkit-transform:translateY(10px);transform:translateY(10px)}.nav--active .burger__meat--1{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.nav--active .burger__meat--2{opacity:0}.nav--active .burger__meat--3{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.nav{font-size:16px;position:fixed;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:#fff;visibility:hidden;z-index:1;}@media screen and (min-width:800px){.nav{display:block;visibility:visible;padding-top:3em;width:100px}}.nav--active .nav{visibility:visible;height:100%;width:100%}.nav__list{text-align:right;list-style:none;margin:0;padding:0;width:50%;}@media screen and (min-width:800px){.nav__list{width:auto}}@media screen and (max-width:799px){.nav__list{-webkit-transform:translateY(-25px);transform:translateY(-25px);opacity:0}.nav--active .nav__list{-webkit-transform:translateY(0);transform:translateY(0);opacity:1;-webkit-transition:all 500ms ease;transition:all 500ms ease}}.nav__list li{margin-bottom:3em;line-height:1.5em;}.nav__list li:last-of-type{margin-bottom:0}@media screen and (min-width:800px){.nav__list li{margin-bottom:1.75em}}.nav__list a{color:#9b9b9b;text-decoration:none;font-size:2em;}.nav__list a.active{color:#111}.nav__list a:hover{color:#111}@media screen and (min-width:800px){.nav__list a{font-size:1em}}body.nav--active{overflow:hidden}main{padding:3rem 1.5rem;}@media screen and (min-width:800px){main{padding-left:calc(1.5rem + 100px)}}@media screen and (max-width:799px){main{padding-top:calc(3rem + 4rem)}}.post-list__container{margin:0 auto;max-width:1200px;width:100%;}@media screen and (min-width:800px){.post-list__container{padding-left:50px}}.post-list{list-style:none;margin:0;padding:0}.post{margin-bottom:1.5rem}.post__title{margin-top:0;font-weight:500;}.post__title a{color:#111;text-decoration:none}.post__date{color:#9b9b9b;font-size:.8rem}.tag__header{-webkit-box-align:baseline;-ms-flex-align:baseline;align-items:baseline;display:-webkit-box;display:-ms-flexbox;display:flex;margin:0 auto;margin-bottom:3rem;}.tag__header a,.tag__header .separator{color:#9b9b9b;font-size:1.5rem}.tag__header a{text-decoration:none}.tag__header .separator{-ms-flex-item-align:center;align-self:center;margin:0 5px}.tag__header .tag__term{margin:0;font-weight:600}
button,
button[type="button"],
button[type="reset"],
button[type="submit"] {
-webkit-appearance: button
}
input,
input[type=text],
input[type=email] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none
}
html,
body {
background-color: #fff;
color: #111;
height: 100%
}
html {
-webkit-box-sizing: border-box;
box-sizing: border-box
}
*,
*:before,
*:after {
padding: 0;
margin: 0;
-webkit-box-sizing: inherit;
box-sizing: inherit
}
html {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
-webkit-font-smoothing: antialiased;
font-size: 95%;
}
@media screen and (min-width:800px) {
html {
font-size: 100%
}
}
@media screen and (min-width:1400px) {
html {
font-size: 115%
}
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin-top: 1.5rem;
margin-bottom: 0;
line-height: 1.5rem;
}
h1 {
font-size: 2.121rem;
line-height: 2.25rem;
margin-top: 2.25rem
}
h2 {
font-size: 1.414rem
}
h3 {
font-size: 1.414/2rem
}
h4 {
font-size: 1.414/3rem
}
h5 {
font-size: 1.414/4rem
}
p {
margin-top: 1.5rem;
margin-bottom: 0;
line-height: 1.5rem
}
ul,
ol {
padding-left: 1.5rem;
margin-top: 1.5rem;
margin-bottom: 1.5rem;
}
ul li,
ol li {
line-height: 1.5rem
}
ul ul,
ol ul,
ul ol,
ol ol {
margin-top: 0;
margin-bottom: 0
}
blockquote {
margin-top: 1.5rem;
margin-bottom: 1.5rem;
line-height: 1.5rem;
color: #717171;
font-style: italic;
}
pre {
line-height: 1.45;
margin-top: 1.5rem;
padding: 16px;
word-wrap: normal;
overflow: auto;
background-color: #f6f8fa;
border-radius: 3px
}
code {
font-size: 85%;
font-family: "SFMono-Regular", Consolas, Menlo, monospace;
padding: .2em .4em;
margin: 0;
background-color: rgba(27, 31, 35, 0.05);
border-radius: 3px
}
pre>code {
word-break: normal;
white-space: pre
}
pre code {
display: inline;
padding: 0;
margin: 0;
overflow: visible;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0
}
.lead {
font-size: 1.414rem
}
.burger__container {
height: 4rem;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
padding: 0 1.5rem;
position: fixed;
width: 100%;
background: #fff;
z-index: 2;
}
@media screen and (min-width:800px) {
.burger__container {
display: none
}
}
.burger {
position: relative;
width: 28px;
height: 28px;
cursor: pointer
}
.burger__meat {
position: absolute;
width: 28px;
height: 2px;
background: #111;
top: calc(50% - 2px / 2);
left: calc(50% - 28px / 2);
-webkit-transition: all 150ms ease-in;
transition: all 150ms ease-in
}
.burger__meat--1 {
-webkit-transform: translateY(-10px);
transform: translateY(-10px)
}
.burger__meat--2 {
width: calc(28px - 6px)
}
.burger__meat--3 {
-webkit-transform: translateY(10px);
transform: translateY(10px)
}
.nav--active .burger__meat--1 {
-webkit-transform: rotate(45deg);
transform: rotate(45deg)
}
.nav--active .burger__meat--2 {
opacity: 0
}
.nav--active .burger__meat--3 {
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg)
}
.nav {
font-size: 16px;
position: fixed;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
background: #fff;
visibility: hidden;
z-index: 1;
}
@media screen and (min-width:800px) {
.nav {
display: block;
visibility: visible;
padding-top: 3em;
width: 100px
}
}
.nav--active .nav {
visibility: visible;
height: 100%;
width: 100%
}
.nav__list {
text-align: right;
list-style: none;
margin: 0;
padding: 0;
width: 50%;
}
@media screen and (min-width:800px) {
.nav__list {
width: auto
}
}
@media screen and (max-width:799px) {
.nav__list {
-webkit-transform: translateY(-25px);
transform: translateY(-25px);
opacity: 0
}
.nav--active .nav__list {
-webkit-transform: translateY(0);
transform: translateY(0);
opacity: 1;
-webkit-transition: all 500ms ease;
transition: all 500ms ease
}
}
.nav__list li {
margin-bottom: 3em;
line-height: 1.5em;
}
.nav__list li:last-of-type {
margin-bottom: 0
}
@media screen and (min-width:800px) {
.nav__list li {
margin-bottom: 1.75em
}
}
.nav__list a {
color: #9b9b9b;
text-decoration: none;
font-size: 2em;
}
.nav__list a.active {
color: #111
}
.nav__list a:hover {
color: #111
}
@media screen and (min-width:800px) {
.nav__list a {
font-size: 1em
}
}
body.nav--active {
overflow: hidden
}
main {
padding: 3rem 1.5rem;
}
@media screen and (min-width:800px) {
main {
padding-left: calc(1.5rem + 100px)
}
}
@media screen and (max-width:799px) {
main {
padding-top: calc(3rem + 4rem)
}
}
.post-list__container {
margin: 0 auto;
max-width: 1200px;
width: 100%;
}
@media screen and (min-width:800px) {
.post-list__container {
padding-left: 50px
}
}
.post-list {
list-style: none;
margin: 0;
padding: 0
}
.post {
margin-bottom: 1.5rem
}
.post__title {
margin-top: 0;
font-weight: 500;
}
.post__title a {
color: #111;
text-decoration: none
}
.post__date {
color: #9b9b9b;
font-size: .8rem
}
.tag__header {
-webkit-box-align: baseline;
-ms-flex-align: baseline;
align-items: baseline;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
margin: 0 auto;
margin-bottom: 3rem;
}
.tag__header a,
.tag__header .separator {
color: #9b9b9b;
font-size: 1.5rem
}
.tag__header a {
text-decoration: none
}
.tag__header .separator {
-ms-flex-item-align: center;
align-self: center;
margin: 0 5px
}
.tag__header .tag__term {
margin: 0;
font-weight: 600
}