This commit is contained in:
wangbudui 2020-01-04 22:59:24 +08:00
parent adf93fe21e
commit 4560f2b33b
15 changed files with 221 additions and 7 deletions

16
.gitignore vendored
View File

@ -1,6 +1,16 @@
# Created by https://www.gitignore.io/api/node,visualstudiocode # Created by https://www.gitignore.io/api/node,hugo,visualstudiocode
# Edit at https://www.gitignore.io/?templates=node,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 ### ### Node ###
# Logs # Logs
@ -119,4 +129,4 @@ temp/
# Ignore all local history of files # Ignore all local history of files
.history .history
# End of https://www.gitignore.io/api/node,visualstudiocode # End of https://www.gitignore.io/api/node,hugo,visualstudiocode

View File

@ -1,3 +1,23 @@
baseURL = "http://example.org/" baseURL = "http://example.org/"
languageCode = "en-us" languageCode = "en-us"
title = "My New Hugo Site" 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

View File

@ -73,8 +73,7 @@ Tables aren't part of the core Markdown spec, but Hugo supports supports them ou
#### Code block with backticks #### Code block with backticks
``` ``` html
html
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>

View File

@ -1,7 +1,6 @@
--- ---
title: "中文Markdown测试" title: "中文Markdown测试"
date: 2020-01-04T20:41:51+08:00 date: 2020-01-04T20:41:51+08:00
draft: true
--- ---
# 中文网页重设与排版_Typo.css_ # 中文网页重设与排版_Typo.css_

View File

@ -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'),
]
}

View File

@ -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'),
]
}

View File

@ -0,0 +1,7 @@
body {
font-family: Optima, Candara, Calibri, Arial, sans-serif;
}
code {
font-family: "Lucida Console", Monaco, monospace;
font-size: 85%;
}

View File

@ -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;
}

View File

@ -0,0 +1,7 @@
module.exports = {
theme: {
extend: {}
},
variants: {},
plugins: []
}

View File

@ -3,7 +3,7 @@
{{- partial "head.html" . -}} {{- partial "head.html" . -}}
<body> <body>
{{- partial "header.html" . -}} {{- partial "header.html" . -}}
<div id="content"> <div id="content" class="">
{{- block "main" . }}{{- end }} {{- block "main" . }}{{- end }}
</div> </div>
{{- partial "footer.html" . -}} {{- partial "footer.html" . -}}

View File

@ -0,0 +1,7 @@
{{ define "main" }}
{{ range .Pages }}
<article class="">
<h1 class=""><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
</article>
{{ end }}
{{ end }}

View File

@ -0,0 +1,6 @@
{{ define "main" }}
<article class="max-w-3xl mx-auto p-4">
<h1 class="">{{ .Title }}</h1>
{{ .Content }}
</article>
{{ end }}

View File

@ -0,0 +1,6 @@
{{ define "main" }}
<article class="">
<h1 class="">{{ .Title }}</h1>
{{ .Content }}
</article>
{{ end }}

View File

@ -0,0 +1,7 @@
{{ if .Site.IsServer }}
{{ $style := resources.Get "css/styles.css" | postCSS (dict "config" "./assets/css/dev/postcss.config.js") }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
{{ else }}
{{ $style := resources.Get "css/styles.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
{{ end }}

View File

@ -0,0 +1,21 @@
{
"name": "hugo-w2ng",
"version": "1.0.0",
"description": "a hugo theme for wrong.wang",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^1.3.0",
"postcss-reporter": "^6.0.1",
"tailwindcss": "^1.1.4"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"theme",
"tailwind"
],
"author": "Wrong Wang",
"license": "MIT"
}