diff --git a/.gitignore b/.gitignore index 21ac847..a42b310 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,16 @@ -# Created by https://www.gitignore.io/api/node,visualstudiocode -# Edit at https://www.gitignore.io/?templates=node,visualstudiocode +# Created by https://www.gitignore.io/api/node,hugo,visualstudiocode +# Edit at https://www.gitignore.io/?templates=node,hugo,visualstudiocode + +### Hugo ### +# Generated files by hugo +/public/ +/resources/_gen/ + +# Executable may be added to repository +hugo.exe +hugo.darwin +hugo.linux ### Node ### # Logs @@ -119,4 +129,4 @@ temp/ # Ignore all local history of files .history -# End of https://www.gitignore.io/api/node,visualstudiocode +# End of https://www.gitignore.io/api/node,hugo,visualstudiocode diff --git a/config.toml b/config.toml index e4b7418..9b92e50 100644 --- a/config.toml +++ b/config.toml @@ -1,3 +1,23 @@ baseURL = "http://example.org/" languageCode = "en-us" title = "My New Hugo Site" +theme = "hugo-w2ng" +pygmentsStyle="github" + +[markup] + [markup.goldmark] + [markup.goldmark.extensions] + definitionList = true + footnote = true + linkify = true + strikethrough = true + table = true + taskList = true + typographer = true + [markup.goldmark.parser] + attribute = true + autoHeadingID = true + [markup.goldmark.renderer] + hardWraps = false + unsafe = true + xHTML = false \ No newline at end of file diff --git a/content/blog/Markdown Syntax Guide.md b/content/blog/Markdown Syntax Guide.md index d60c404..c46a304 100644 --- a/content/blog/Markdown Syntax Guide.md +++ b/content/blog/Markdown Syntax Guide.md @@ -73,8 +73,7 @@ Tables aren't part of the core Markdown spec, but Hugo supports supports them ou #### Code block with backticks -``` -html +``` html
diff --git a/content/blog/中文Markdown测试.md b/content/blog/中文Markdown测试.md index cf530a5..37ffdc4 100644 --- a/content/blog/中文Markdown测试.md +++ b/content/blog/中文Markdown测试.md @@ -1,7 +1,6 @@ --- title: "中文Markdown测试" date: 2020-01-04T20:41:51+08:00 -draft: true --- # 中文网页重设与排版:_Typo.css_ diff --git a/themes/hugo-w2ng/assets/css/dev/postcss.config.js b/themes/hugo-w2ng/assets/css/dev/postcss.config.js new file mode 100644 index 0000000..239ed8d --- /dev/null +++ b/themes/hugo-w2ng/assets/css/dev/postcss.config.js @@ -0,0 +1,21 @@ +// Custom PurgeCSS extractor for Tailwind that allows special characters in +// class names. +// +// https://github.com/FullHuman/purgecss#extractor +class TailwindExtractor { + static extract(content) { + return content.match(/[A-Za-z0-9-_:\/]+/g) || []; + } +} + +const themeDir = __dirname + '/../../../'; + +module.exports = { + plugins: [ + require('postcss-import')({ + path: [themeDir] + }), + require('tailwindcss')(themeDir + 'assets/css/tailwind.config.js'), + require('autoprefixer'), + ] +} diff --git a/themes/hugo-w2ng/assets/css/postcss.config.js b/themes/hugo-w2ng/assets/css/postcss.config.js new file mode 100644 index 0000000..b35fc76 --- /dev/null +++ b/themes/hugo-w2ng/assets/css/postcss.config.js @@ -0,0 +1,33 @@ +// Custom PurgeCSS extractor for Tailwind that allows special characters in +// class names. +// +// https://github.com/FullHuman/purgecss#extractor +class TailwindExtractor { + static extract(content) { + return content.match(/[A-Za-z0-9-_:\/]+/g) || []; + } +} + +const themeDir = __dirname + '/../../'; + +module.exports = { + plugins: [ + require('postcss-import')({ + path: [themeDir] + }), + require('tailwindcss')(themeDir + 'assets/css/tailwind.config.js'), + require('@fullhuman/postcss-purgecss')({ + content: [themeDir + 'layouts/**/*.html'], + extractors: [ + { + extractor: TailwindExtractor, + extensions: ['html'] + }], + fontFace: true + }), + require('autoprefixer')({ + grid: true + }), + require('postcss-reporter'), + ] +} diff --git a/themes/hugo-w2ng/assets/css/site.css b/themes/hugo-w2ng/assets/css/site.css new file mode 100644 index 0000000..8ffcecd --- /dev/null +++ b/themes/hugo-w2ng/assets/css/site.css @@ -0,0 +1,7 @@ +body { + font-family: Optima, Candara, Calibri, Arial, sans-serif; +} +code { + font-family: "Lucida Console", Monaco, monospace; + font-size: 85%; +} diff --git a/themes/hugo-w2ng/assets/css/styles.css b/themes/hugo-w2ng/assets/css/styles.css new file mode 100644 index 0000000..7fa9bbf --- /dev/null +++ b/themes/hugo-w2ng/assets/css/styles.css @@ -0,0 +1,71 @@ +/* Tailwind base - put variables under: tailwind.config.js */ +@import "node_modules/tailwindcss/base"; +/* Tailwind component classes registered by plugins*/ +@import "node_modules/tailwindcss/components"; +/* Site Specific */ +@import "assets/css/site"; +/* Tailwind's utility classes - generated based on config file */ +@import "node_modules/tailwindcss/utilities"; + +h1 { + @apply text-4xl; +} +h2 { + @apply text-2xl; +} +h3 { + @apply text-lg; +} +h1, +h2, +h3, +h4 { + @apply font-bold leading-loose; +} + +blockquote { + border-left: 5px solid #ccc; + @apply bg-gray-100 p-3 mx-3 my-2; +} + +table { + @apply m-auto; + border-top: 1px solid #666; + border-bottom: 1px solid #666; +} +table thead th { + border-bottom: 1px solid #ddd; +} +th, +td { + @apply p-1; +} +thead, +tfoot, +tr:nth-child(even) { + @apply bg-gray-200; +} + +pre { + border: 1px solid #ddd; + box-shadow: 5px 5px 5px #eee; + @apply overflow-x-auto p-4; +} +code { + @apply bg-gray-200; +} +pre code { + @apply bg-transparent; +} + +ul { + @apply text-base pl-8 list-disc; +} + +ol { + @apply text-base pl-8 list-decimal; +} + +kbd { + @apply text-xs inline-block rounded border px-1 py-5 align-middle font-normal font-mono shadow; +} diff --git a/themes/hugo-w2ng/assets/css/tailwind.config.js b/themes/hugo-w2ng/assets/css/tailwind.config.js new file mode 100644 index 0000000..dd6532c --- /dev/null +++ b/themes/hugo-w2ng/assets/css/tailwind.config.js @@ -0,0 +1,7 @@ +module.exports = { + theme: { + extend: {} + }, + variants: {}, + plugins: [] +} diff --git a/themes/hugo-w2ng/layouts/_default/baseof.html b/themes/hugo-w2ng/layouts/_default/baseof.html index 5f8e2ec..acc5bd7 100644 --- a/themes/hugo-w2ng/layouts/_default/baseof.html +++ b/themes/hugo-w2ng/layouts/_default/baseof.html @@ -3,7 +3,7 @@ {{- partial "head.html" . -}} {{- partial "header.html" . -}} -