1
0
Fork 0

run prettier

This commit is contained in:
nanxiaobei 2022-11-15 08:06:02 +08:00
parent e7ad0b30c6
commit 244187a816
17 changed files with 401 additions and 297 deletions

View File

@ -1,5 +1,4 @@
module.exports = {
printWidth: 100,
singleQuote: true,
// https://github.com/tailwindlabs/prettier-plugin-tailwindcss

File diff suppressed because it is too large Load Diff

View File

@ -10,11 +10,11 @@ Written in Go, Hugo is an open source static site generator available under the
Hugo makes use of a variety of open source projects including:
* https://github.com/yuin/goldmark
* https://github.com/alecthomas/chroma
* https://github.com/muesli/smartcrop
* https://github.com/spf13/cobra
* https://github.com/spf13/viper
- https://github.com/yuin/goldmark
- https://github.com/alecthomas/chroma
- https://github.com/muesli/smartcrop
- https://github.com/spf13/cobra
- https://github.com/spf13/viper
Hugo is ideal for blogs, corporate websites, creative portfolios, online magazines, single page applications or even a website with thousands of pages.

View File

@ -1,5 +1,5 @@
---
date: 2019-05-28
type: section
layout: "archives"
layout: 'archives'
---

View File

@ -8,9 +8,11 @@ tags = [
]
+++
Emoji can be enabled in a Hugo project in a number of ways.
Emoji can be enabled in a Hugo project in a number of ways.
<!--more-->
The [`emojify`](https://gohugo.io/functions/emojify/) function can be called directly in templates or [Inline Shortcodes](https://gohugo.io/templates/shortcode-templates/#inline-shortcodes).
The [`emojify`](https://gohugo.io/functions/emojify/) function can be called directly in templates or [Inline Shortcodes](https://gohugo.io/templates/shortcode-templates/#inline-shortcodes).
To enable emoji globally, set `enableEmoji` to `true` in your site's [configuration](https://gohugo.io/getting-started/configuration/) and then you can type emoji shorthand codes directly in content files; e.g.
@ -19,17 +21,18 @@ To enable emoji globally, set `enableEmoji` to `true` in your site's [configurat
The [Emoji cheat sheet](http://www.emoji-cheat-sheet.com/) is a useful reference for emoji shorthand codes.
***
---
**N.B.** The above steps enable Unicode Standard emoji characters and sequences in Hugo, however the rendering of these glyphs depends on the browser and the platform. To style the emoji you can either use a third party emoji font or a font stack; e.g.
{{< highlight html >}}
.emoji {
font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
}
{{< /highlight >}}
{{< css.inline >}}
<style>
.emojify {
font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
@ -43,4 +46,5 @@ The [Emoji cheat sheet](http://www.emoji-cheat-sheet.com/) is a useful reference
}
}
</style>
{{< /css.inline >}}

View File

@ -17,6 +17,7 @@ aliases = ["migrate-from-jekyl"]
+++
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
@ -24,10 +25,15 @@ This article offers a sample of basic Markdown syntax that can be used in Hugo c
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
@ -43,7 +49,7 @@ The blockquote element represents content that is quoted from another source, op
#### Blockquote without attribution
> Tiam, ad mint andaepu dandae nostion secatur sequo quae.
> **Note** that you can use *Markdown syntax* within a blockquote.
> **Note** that you can use _Markdown syntax_ within a blockquote.
#### Blockquote with attribution
@ -56,31 +62,31 @@ The blockquote element represents content that is quoted from another source, op
Tables aren't part of the core Markdown spec, but Hugo supports supports them out-of-the-box.
Name | Age
--------|------
Bob | 27
Alice | 23
| Name | Age |
| ----- | --- |
| Bob | 27 |
| Alice | 23 |
#### Inline Markdown within tables
| Italics | Bold | Code |
| -------- | -------- | ------ |
| *italics* | **bold** | `code` |
| --------- | -------- | ------ |
| _italics_ | **bold** | `code` |
## Code Blocks
#### Code block with backticks
```html
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example HTML5 Document</title>
</head>
<body>
<p>Test</p>
</body>
<head>
<meta charset="utf-8" />
<title>Example HTML5 Document</title>
</head>
<body>
<p>Test</p>
</body>
</html>
```
@ -98,7 +104,9 @@ Tables aren't part of the core Markdown spec, but Hugo supports supports them ou
</html>
#### Code block with Hugo's internal highlight shortcode
{{< highlight html >}}
<!doctype html>
<html lang="en">
<head>
@ -121,19 +129,19 @@ Tables aren't part of the core Markdown spec, but Hugo supports supports them ou
#### Unordered List
* List item
* Another item
* And another item
- List item
- Another item
- And another item
#### Nested list
* Fruit
* Apple
* Orange
* Banana
* Dairy
* Milk
* Cheese
- Fruit
- Apple
- Orange
- Banana
- Dairy
- Milk
- Cheese
## Other Elements — abbr, sub, sup, kbd, mark

View File

@ -7,13 +7,14 @@ 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:
- Include the partial in your templates like so:
```bash
{{ if or .Params.math .Site.Params.math }}
@ -28,6 +29,7 @@ In this example we will be using [KaTeX](https://katex.org/)
{{< math.inline >}}
{{ if or .Page.Params.math .Site.Params.math }}
<!-- KaTeX -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
@ -38,12 +40,14 @@ In this example we will be using [KaTeX](https://katex.org/)
### Examples
{{< math.inline >}}
<p>
Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
</p>
{{</ math.inline >}}
Block math:
$$
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
$$

View File

@ -36,10 +36,12 @@ Victa caducifer, malo vulnere contra dicere aurato, ludit regale, voca! Retorsit
Iubar proles corpore raptos vero auctor imperium; sed et huic: manus caeli Lelegas tu lux. Verbis obstitit intus oblectamina fixis linguisque ausus sperare Echionides cornuaque tenent clausit possit. Omnia putatur. Praeteritae refert ausus; ferebant e primus lora nutat, vici quae mea ipse. Et iter nil spectatae vulnus haerentia iuste et exercebat, sui et.
Eurytus Hector, materna ipsumque ut Politen, nec, nate, ignari, vernum cohaesit sequitur. Vel **mitis temploque** vocatus, inque alis, *oculos nomen* non silvis corpore coniunx ne displicet illa. Crescunt non unus, vidit visa quantum inmiti flumina mortis facto sic: undique a alios vincula sunt iactata abdita! Suspenderat ego fuit tendit: luna, ante urbem Propoetides **parte**.
Eurytus Hector, materna ipsumque ut Politen, nec, nate, ignari, vernum cohaesit sequitur. Vel **mitis temploque** vocatus, inque alis, _oculos nomen_ non silvis corpore coniunx ne displicet illa. Crescunt non unus, vidit visa quantum inmiti flumina mortis facto sic: undique a alios vincula sunt iactata abdita! Suspenderat ego fuit tendit: luna, ante urbem Propoetides **parte**.
{{< css.inline >}}
<style>
.canon { background: white; width: 100%; height: auto; }
</style>
{{< /css.inline >}}

View File

@ -10,8 +10,8 @@ tags = [
+++
Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-management/shortcodes/#use-hugos-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.
<!--more-->
---
## <!--more-->
## YouTube Privacy Enhanced Shortcode

View File

@ -1,3 +1,7 @@
{{ define "main" }}
<h1 class="absolute inset-x-8 top-0 bottom-20 flex items-center justify-center text-9xl">404</h1>
<h1
class="absolute inset-x-8 top-0 bottom-20 flex items-center justify-center text-9xl"
>
404
</h1>
{{ end }}

View File

@ -5,8 +5,10 @@
{{ $.Scratch.Delete "avatar_url" }}<!---->
<!-- bg_color -->
{{ $color_map := dict "linen" "#faf6f1" "wheat" "#f1efe1" "gray" "#fbfbfb" "light" "#fff" }}<!---->
{{ $.Scratch.Set "bg_color" (index $color_map (site.Params.color | default (print "linen"))) }}<!---->
{{ $color_map := dict "linen" "#faf6f1" "wheat" "#f1efe1" "gray" "#fbfbfb"
"light" "#fff" }}<!---->
{{ $.Scratch.Set "bg_color" (index $color_map (site.Params.color | default
(print "linen"))) }}<!---->
<!-- social_list -->
{{ $social_params := slice "twitter" "github" "instagram" "rss" }}<!---->

View File

@ -12,7 +12,8 @@
{{ end }}
<!-- Articles -->
{{ $paginator := .Paginate $pages }} {{ range $index, $page := $paginator.Pages }}<!---->
{{ $paginator := .Paginate $pages }} {{ range $index, $page := $paginator.Pages
}}<!---->
<!-- avatar -->
{{ if and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) }}<!---->
@ -34,7 +35,8 @@
<div>
<h1 class="mt-1.5 mb-3 text-3xl font-bold">{{ site.Params.name }}</h1>
<div class="break-words">
{{ site.Params.bio | default (print "Personal blog by " site.Params.name) }}
{{ site.Params.bio | default (print "Personal blog by " site.Params.name)
}}
</div>
</div>
{{ end }}
@ -45,7 +47,9 @@
<section class="relative my-10 first-of-type:mt-0 last-of-type:mb-0">
<h2 class="!my-0 pb-1 !leading-none">{{ .Title }}</h2>
<time class="text-sm opacity-60">{{ .Date | time.Format ":date_medium" }}</time>
<time class="text-sm opacity-60"
>{{ .Date | time.Format ":date_medium" }}</time
>
<a class="absolute inset-0" href="{{ .Permalink }}"></a>
</section>
{{ end }}
@ -57,7 +61,9 @@
<a class="btn" href="{{ $paginator.Prev.URL }}">← {{ i18n "prev_page" }}</a>
{{ end }}<!---->
{{ if $paginator.HasNext }}
<a class="btn ml-auto" href="{{ $paginator.Next.URL }}">{{ i18n "next_page" }} →</a>
<a class="btn ml-auto" href="{{ $paginator.Next.URL }}"
>{{ i18n "next_page" }} →</a
>
{{ end }}
</nav>
{{ end }}<!---->

View File

@ -37,7 +37,9 @@
{{ if and (gt (len $pages) 1) (in $pages . ) }}
<nav class="mt-24 flex rounded-lg bg-black/[3%] text-lg dark:bg-white/[8%]">
{{ with $pages.Next . }}
<a class="flex w-1/2 items-center p-6 pr-3 no-underline" href="{{ .Permalink }}"
<a
class="flex w-1/2 items-center p-6 pr-3 no-underline"
href="{{ .Permalink }}"
><span class="mr-1.5"></span><span>{{ .Name }}</span></a
>
{{ end }}<!---->

View File

@ -1,11 +1,18 @@
<footer class="opaco mx-auto flex h-[5rem] max-w-3xl items-center px-8 text-[0.9em] opacity-60">
<footer
class="opaco mx-auto flex h-[5rem] max-w-3xl items-center px-8 text-[0.9em] opacity-60"
>
<div class="mr-auto">
&copy; {{ now.Year }}
<a class="link" href="{{ `` | absURL }}">{{ site.Title }}</a>
</div>
<a class="link mx-6" href="https://gohugo.io/" rel="noopener" target="_blank">Powered by Hugo</a
<a class="link mx-6" href="https://gohugo.io/" rel="noopener" target="_blank"
>Powered by Hugo</a
>
<a class="link" href="https://github.com/nanxiaobei/hugo-paper" rel="noopener" target="_blank"
<a
class="link"
href="https://github.com/nanxiaobei/hugo-paper"
rel="noopener"
target="_blank"
>▷ Paper 6</a
>
</footer>

View File

@ -1,7 +1,10 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<!-- Title -->
<title>{{ if not .IsHome }}{{ .Title }} - {{ end }}{{ site.Title }}</title>
@ -10,7 +13,10 @@
<meta name="theme-color" />
{{ if eq .Kind "page" }}
<meta name="description" content="{{ .Summary }}" />
<meta name="author" content="{{ .Params.Author | default site.Author.name }}" />
<meta
name="author"
content="{{ .Params.Author | default site.Author.name }}"
/>
{{ else }}
<meta name="description" content="{{ site.Params.description }}" />
<meta name="author" content="{{ site.Author.name }}" />
@ -21,7 +27,8 @@
<!---->
{{ $custom_css := resources.Get "custom.css" }}
<!---->
{{ $css := slice $main_css $custom_css | resources.Concat "main.css" | minify }}
{{ $css := slice $main_css $custom_css | resources.Concat "main.css" | minify
}}
<link rel="preload stylesheet" as="style" href="{{ $css.Permalink }}" />
{{ if and .IsPage (not site.Params.disableHLJS) }}
@ -33,15 +40,9 @@
{{ end }}
<!-- Preload -->
{{ $dark_icon := "theme.png" }}
{{ if site.Params.monoDarkIcon }}
{{ $dark_icon := "theme.svg" }}
{{ end }}
<link
rel="preload"
as="image"
href="{{ $dark_icon | absURL }}"
/>
{{ $dark_icon := "theme.png" }} {{ if site.Params.monoDarkIcon }} {{
$dark_icon := "theme.svg" }} {{ end }}
<link rel="preload" as="image" href="{{ $dark_icon | absURL }}" />
{{ $avatar_url := $.Scratch.Get "avatar_url" }}
<!---->

View File

@ -1,6 +1,8 @@
<header class="mx-auto flex h-[5rem] max-w-3xl px-8 lg:justify-center">
<div class="relative z-50 mr-auto flex items-center">
<a class="-translate-x-[1px] -translate-y-0.5 text-3xl font-bold" href="{{ `` | absURL }}"
<a
class="-translate-x-[1px] -translate-y-0.5 text-3xl font-bold"
href="{{ `` | absURL }}"
>{{ site.Title }}</a
>
<a

View File

@ -1,6 +1,7 @@
<!---->{{ if not (.Get "summary") }}
<!---->{{ errorf "missing param 'summary': %s" .Position }}
<!---->{{ else if not (.Get "content") }}{{ warnf "missing param 'content': %s" .Position }}
<!---->{{ else if not (.Get "content") }}{{ warnf "missing param 'content': %s"
.Position }}
<!---->{{ end }}
<details {{ if (eq (.Get `openByDefault`) true) }}open="true" {{ end }}>