Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
feat(author): add author_link and fix highlight bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq committed Jan 31, 2020
1 parent 2a7611b commit 8aa4b6d
Show file tree
Hide file tree
Showing 22 changed files with 136 additions and 110 deletions.
4 changes: 3 additions & 1 deletion archetypes/default.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
author: ""
author_link: ""
title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ .Date }}
lastmod: {{ .Date }}
Expand All @@ -16,7 +18,7 @@ featured_image_preview: ""

comment: true
toc: false
autoCollapseToc: true
auto_collapse_toc: true
math: false
---

Expand Down
19 changes: 16 additions & 3 deletions assets/css/_core/_media.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,35 @@
max-width: 780px;

.post-toc {
width: 300px;
margin-left: 800px;
}
}
}

@media only screen and (max-width: 1300px) {
@media only screen and (max-width: 1440px) {
.warpper {
max-width: 680px;

.post-toc {
width: 240px;
margin-left: 700px;
}
}
}

@media only screen and (max-width: 1200px) {
.warpper {
max-width: 560px;

.post-toc {
width: 180px;
margin-left: 580px;
}
}
}

@media only screen and (max-width: 1080px) {
@media only screen and (max-width: 960px) {
.navbar {
.navbar-container {
margin: 0 2rem;
Expand Down Expand Up @@ -52,7 +65,7 @@

.categories-card {
.card-item {
width: 95%;
width: 100%;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion assets/css/_page/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.warpper {
position: relative;
width: 100%;
max-width: 960px;
max-width: 980px;
margin: 0 auto;
padding-top: 6rem;

Expand Down
24 changes: 12 additions & 12 deletions assets/css/_page/_terms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,20 @@
padding: 0 2%;
position: relative;

.categories {
.card-item-wrapper {
width: 100%;
overflow: hidden;

.card-item-title {
font-size: 1.2rem;
font-weight: bold;
display: inline-block;
}

span {
float: right;
padding-right: 1rem;
}
}
}
}
Expand Down Expand Up @@ -70,14 +81,3 @@
.more-post {
text-align: right;
}

.categories {
h3 {
display: inline-block;
}

span {
float: right;
padding-right: 1rem;
}
}
2 changes: 1 addition & 1 deletion assets/css/_partial/_post/_code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ p > code {
}

@each $sign, $text in $code-type-list {
& .#{$sign} table::after {
&.#{$sign} table::after {
content: $text;
}
}
Expand Down
5 changes: 2 additions & 3 deletions assets/css/_partial/_post/_toc.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.post-toc {
display: block;
position: absolute;
width: 240px;
max-width: 300px;
margin-left: 980px;
width: 360px;
margin-left: 1000px;
padding: .8rem;
border-left: 1px solid $global-border-color;
word-wrap: break-word;
Expand Down
84 changes: 42 additions & 42 deletions assets/css/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,46 +70,46 @@ $code-font-family: Source Code Pro, Consolas, Liberation Mono, Menlo, Courier, m
// Code type list.
$code-type-list: (
// Custom code type
language-bash: "Bash",
language-c: "C",
language-cs: "C#",
language-cpp: "C++",
language-css: "CSS",
language-coffeescript: "CoffeeScript",
language-html: "HTML",
language-xml: "XML",
language-http: "HTTP",
language-json: "JSON",
language-java: "Java",
language-js: "JavaScript",
language-javascript: "JavaScript",
language-makefile: "Makefile",
language-markdown: "Markdown",
language-objectivec: "Objective-C",
language-php: "PHP",
language-perl: "Perl",
language-python: "Python",
language-ruby: "Ruby",
language-sql: "SQL",
language-shell: "Shell",
language-erlang: "Erlang",
language-go: "Go",
language-go-html-template: "Go HTML Template",
language-groovy: "Groovy",
language-haskell: "Haskell",
language-kotlin: "Kotlin",
language-clojure: "Clojure",
language-less: "Less",
language-lisp: "Lisp",
language-lua: "Lua",
language-matlab: "Matlab",
language-rust: "Rust",
language-scss: "Scss",
language-scala: "Scala",
language-swift: "Swift",
language-typescript: "TypeScript",
language-yml: "YAML",
language-yaml: "YAML",
language-toml: "TOML",
language-diff: "Diff"
language-bash: 'Bash',
language-c: 'C',
language-cs: 'C#',
language-cpp: 'C++',
language-css: 'CSS',
language-coffeescript: 'CoffeeScript',
language-html: 'HTML',
language-xml: 'XML',
language-http: 'HTTP',
language-json: 'JSON',
language-java: 'Java',
language-js: 'JavaScript',
language-javascript: 'JavaScript',
language-makefile: 'Makefile',
language-markdown: 'Markdown',
language-objectivec: 'Objective-C',
language-php: 'PHP',
language-perl: 'Perl',
language-python: 'Python',
language-ruby: 'Ruby',
language-sql: 'SQL',
language-shell: 'Shell',
language-erlang: 'Erlang',
language-go: 'Go',
language-go-html-template: 'Go HTML Template',
language-groovy: 'Groovy',
language-haskell: 'Haskell',
language-kotlin: 'Kotlin',
language-clojure: 'Clojure',
language-less: 'Less',
language-lisp: 'Lisp',
language-lua: 'Lua',
language-matlab: 'Matlab',
language-rust: 'Rust',
language-scss: 'Scss',
language-scala: 'Scala',
language-swift: 'Swift',
language-typescript: 'TypeScript',
language-yml: 'YAML',
language-yaml: 'YAML',
language-toml: 'TOML',
language-diff: 'Diff'
) !default;
9 changes: 5 additions & 4 deletions assets/js/blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ jQuery(function($) {
});
};

_Blog.chroma = function() {
_Blog.chroma = function () {
const blocks = document.querySelectorAll('.highlight > .chroma');
for (let i = 0; i < blocks.length; i++) {
const block = blocks[i];
const afterHighLight = block.querySelector('pre.chroma > code');
const lang = afterHighLight ? afterHighLight.className : '';
const codes = block.querySelectorAll('pre.chroma > code');
const code = codes[codes.length - 1];
const lang = code ? code.className.toLowerCase() : '';
block.className += ' ' + lang;
}
};
Expand Down Expand Up @@ -298,4 +299,4 @@ jQuery(function($) {
_Blog.typeit();
_Blog.toc();
});
});
});
2 changes: 1 addition & 1 deletion exampleSite/content/posts/LoveIt-Preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ featured_image_preview: ""

comment: true
toc: true
autoCollapseToc: true
auto_collapse_toc: true
math: true
---

Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/posts/markdown-syntax.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
author: "Hugo Authors"
author_link: "https://gohugo.io/"
title: "Markdown Syntax Guide"
date: 2020-01-30T21:57:40+08:00
lastmod: 2020-01-30T21:57:40+08:00
Expand All @@ -17,15 +18,14 @@ tags: [
]
categories: [
"themes",
"syntax",
]

featured_image: /images/markdown.png
featured_image_preview: ""

comment: true
toc: true
autoCollapseToc: true
auto_collapse_toc: true
math: false
---

Expand Down
2 changes: 1 addition & 1 deletion exampleSite/zh/content/posts/Basic-Markdown-Preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ featu红色_image_preview: ''

comment: true
toc: true
autoCollapseToc: false
auto_collapse_toc: false
math: true
---

Expand Down
3 changes: 0 additions & 3 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ other = "min"

[second]
other = "sec"

[return]
other = "return"
# === posts/single.html ===

# === 404.html ===
Expand Down
3 changes: 0 additions & 3 deletions i18n/zh.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ other = "分"

[second]
other = ""

[return]
other = "返回"
# === posts/single.html ===

# === 404.html ===
Expand Down
6 changes: 3 additions & 3 deletions layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<figure>
<img
{{- $res := resources.Get "svg/loading.svg" | minify -}}
{{ $res := resources.Get "svg/loading.svg" | minify -}}
src="{{ $res.RelPermalink }}"
data-sizes="auto"
data-src="{{ .Destination | safeURL }}"
alt="{{ .Text }}"
{{- with .Title -}}
{{ with .Title -}}
title="{{ . }}"
{{- end -}}
{{ end -}}
class="lazyload"
>
<figcaption class="image-caption">
Expand Down
8 changes: 4 additions & 4 deletions layouts/_default/_markup/render-link.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<a href="{{ .Destination | safeURL }}"
{{- with .Title -}}
{{ with .Title -}}
title="{{ . }}"
{{- end -}}
{{- if strings.HasPrefix .Destination "http" -}}
{{ end -}}
{{ if strings.HasPrefix .Destination "http" -}}
target="_blank"
{{- end -}}
{{ end -}}
>
{{- .Text -}}
</a>
6 changes: 5 additions & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 class="post-title animated pulse faster">
{{- $content = replaceRE $REin $REout $content -}}

{{- $REin = `<sup>\[return\]</sup>` -}}
{{- $REout = printf "<sup>[%s]</sup>" (T "return") -}}
{{- $REout = `↩︎` -}}
{{- $content = replaceRE $REin $REout $content -}}

{{- $REin = `<(h[23456]) (id=".+?")>` -}}
Expand All @@ -28,6 +28,10 @@ <h1 class="post-title animated pulse faster">
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
{{- $content = replaceRE $REin $REout $content -}}

{{- $REin = `<li (id="fn:.+?")(.*?)>\s?<p>` -}}
{{- $REout = `<li $2><p><a class="post-dummy-target" $1></a>` -}}
{{- $content = replaceRE $REin $REout $content -}}

{{- $content | safeHTML -}}
</div>
</div>
Expand Down
Loading

0 comments on commit 8aa4b6d

Please sign in to comment.