diff --git a/.gitignore b/.gitignore index 0c376ea..d298be1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -public/ -.DS_Store +public/ \ No newline at end of file diff --git a/README.md b/README.md index 4c7125c..5653e33 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,10 @@ Anubis2 is another simple minimalist theme for [Hugo blog engine](https://gohugo.io/), check our [Demo](https://www.junyi.dev/). -![image](https://github.com/Junyi-99/hugo-theme-anubis2/assets/14367694/8d9a591b-e168-4328-a770-eb2e8f04f657) - -| Light | Dark (Code) | Dark (Math) | -| :------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------: | -| demo1 | demo3 | demo2 | - - -> [!IMPORTANT] -> **Update Your Blog Configuration** -> Please ensure your blog configuration file (`hugo.toml`, `hugo.yaml`, or `hugo.json`) is updated to the latest version provided with the template. -> -> **Hugo frequently changes its configuration file structure**, which may lead to compatibility issues if your configuration is outdated. +> 📝 Please note that anubis2 is under active maintenance, so please REMEMBER to keep your theme up to date! > -> Check the [Anubis2 template](https://github.com/Junyi-99/hugo-theme-anubis2/tree/main/exampleSiteMultilingual) for the latest config file. - +![image](https://github.com/Junyi-99/hugo-theme-anubis2/assets/14367694/8d9a591b-e168-4328-a770-eb2e8f04f657) ## Highlighted Features @@ -56,17 +44,16 @@ Don't be panic, configure Anubis2 is really **simple**. baseURL = "https://hugo-theme-anubis2.netlify.app/" languageCode = "en-us" theme = "anubis2" -title = "Anubis2 Demo Site" +title = "Your Site's Name" -[params.author] -name = "Junyi" +[author] +name = "Your Name" [markup.goldmark.renderer] -unsafe = true # true | false; Enable unsafe mode to have a better experience +unsafe = true # Enable unsafe mode to have a better experience [markup.highlight] -style = 'base16-snazzy' # Chroma style, find more at here: https://swapoff.org/chroma/playground/ - +style = 'base16-snazzy' # Highlight.js style ``` You are encouraged keeping other fields as defaults and fine-tune them when you have time! (see [Full Configuration Examples](https://github.com/Junyi-99/hugo-theme-anubis2/wiki/Configuration-Example)) diff --git a/assets/css/main.css b/assets/css/main.css index 5a56b46..419a06c 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -154,20 +154,14 @@ thead { table { max-width: 100%; - display: block; - overflow: scroll; border-spacing: 0; - border-collapse: collapse; - border-top-left-radius: 6px; - border-top-right-radius: 6px; - font-size: 14px; } + th, td { - padding: 0.25em 0.5em; + padding: 0.5em 1em; border: 1px double var(--table-border-color); - } /* Code */ @@ -181,8 +175,7 @@ kbd { color: var(--pre-color); background-color: var(--pre-bg-color); font-family: 'Menlo', 'Courier New', 'Consolas', monospace; - font-size: 14.4px; - /* 18px * 0.6 */ + font-size: 14.4px; /* 18px * 0.6 */ line-height: 154%; border-radius: 6px; border: 1px solid var(--pre-border-color); @@ -191,8 +184,7 @@ kbd { /* tag */ code { - font-size: 14.4px; - /* 18px * 0.6 */ + font-size: 14.4px; /* 18px * 0.6 */ padding: 0.1em 0.3em; } @@ -211,8 +203,7 @@ p kbd, pre kbd, p kbd kbd, pre kbd kbd { - font-size: 14.4px; - /* 18px * 0.6 */ + font-size: 14.4px; /* 18px * 0.6 */ background-color: var(--kbd-bg-color); border: 1px solid var(--pre-border-color); border-width: 1px 2px 2px 1px; @@ -258,16 +249,11 @@ div.highlight { margin-bottom: 14px; } -div.highlight div { - overflow: scroll; -} - div.highlight pre { border: none; display: grid; margin: 0px; - overflow: auto; - /* Have to add this line, otherwise the "pre" and "code" will have different width */ + overflow: auto; /* Have to add this line, otherwise the "pre" and "code" will have different width */ /* padding-left: 10px; */ /* padding-right: 10px; */ /* padding-top: 10px; */ diff --git a/data/social.yaml b/data/social.yaml index 9e78db2..65e0ba3 100644 --- a/data/social.yaml +++ b/data/social.yaml @@ -16,7 +16,6 @@ social_icons: vk: https://vk.com/%s youtube: https://www.youtube.com/c/%s 4chan: - bluesky: https://bsky.app/profile/%s # docs: gitlab: leetcode: https://leetcode.com/%s diff --git a/exampleSiteMultilingual/content/posts/demo-multiline-codes.md b/exampleSiteMultilingual/content/posts/demo-multiline-codes.md index ed32b63..e3df562 100644 --- a/exampleSiteMultilingual/content/posts/demo-multiline-codes.md +++ b/exampleSiteMultilingual/content/posts/demo-multiline-codes.md @@ -10,31 +10,7 @@ tags = [ ] +++ -```c {linenos=table, hl_lines=[1,"3-4",8], linenostart=199} -int main() { - int a = 1; - if (a == 999) - // This is a very long comment to test the `overflow` attribute defined in CSS. The `overflow` property in CSS deals with the content when it overflows the block-level container. It can take the following values: `visible` (default), `hidden`, `scroll`, `auto`, and `clip`. - // If `visible` is specified, the content is not clipped and can render outside the container. If `hidden` is specified, the content is clipped and the rest of the content will be invisible. If `scroll` is specified, the browser should provide a scrolling mechanism for the user to access the clipped content. - } - return 0; -} -``` - -## Truth Table - -| Item | Line Numbers | Highlight Lines | Anchor Lines | Wide CodeBlock Scroll | Supported | -| ------------------------ | ------------ | --------------- | ------------ | --------------------- | --------- | -| **Full Feature Support** | ture | true | true | ✅ | ✅ | -| | table | true | true | ✅ | ✅ | -| | table | true | false | ✅ | ✅ | -| | inline | | | ✅ | ✅ | -| | ture | true | false | ✅ | ✅ | -| | ture | false | false | ✅ | ✅ | -| | false | true | / | ✅ | ✅ | -| Basic Support | false | false | / | ✅ | ✅ | - -Note: Anubis2 does not support `hl_inline=true` +There are 9 tests. @@ -69,7 +45,7 @@ int main() { int main() { int a = 1; if (a == 999) - // This is a very long comment to test the `overflow` attribute defined in CSS. The `overflow` property in CSS deals with the content when it overflows the block-level container. It can take the following values: `visible` (default), `hidden`, `scroll`, `auto`, and `clip`. + // This is a very long comment to test the `overflow` attribute defined in CSS. The `overflow` property in CSS deals with the content when it overflows the block-level container. It can take the following values: `visible` (default), `hidden`, `scroll`, `auto`, and `clip`. // If `visible` is specified, the content is not clipped and can render outside the container. If `hidden` is specified, the content is clipped and the rest of the content will be invisible. If `scroll` is specified, the browser should provide a scrolling mechanism for the user to access the clipped content. } return 0; @@ -126,34 +102,30 @@ Now you can click on the line number to get a link to that line. int main() { int a = 1; if (a == 999) - // This is a very long comment to test the `overflow` attribute defined in CSS. The `overflow` property in CSS deals with the content when it overflows the block-level container. It can take the following values: `visible` (default), `hidden`, `scroll`, `auto`, and `clip`. + // This is a very long comment to test the `overflow` attribute defined in CSS. The `overflow` property in CSS deals with the content when it overflows the block-level container. It can take the following values: `visible` (default), `hidden`, `scroll`, `auto`, and `clip`. // If `visible` is specified, the content is not clipped and can render outside the container. If `hidden` is specified, the content is clipped and the rest of the content will be invisible. If `scroll` is specified, the browser should provide a scrolling mechanism for the user to access the clipped content. } return 0; } ``` -### Highlight Inline are not supported by Anubis2 ❌ +### Line Number (table) and Highlight Inline (❌ Not supported by Anubis2) - ```c {linenos=true,hl_lines=[1,3,5], hl_inline=true} + ```c {linenos=true,hl_lines=[1,"3-4",8], hl_inline=true} // codes ... ``` -```c {linenos=true,hl_lines=[1,3,5], hl_inline=true} +```c {linenos=true,hl_lines=[1,"3-4",8], hl_inline=true} int main() { int a = 1; if (a == 999) + // This is a very long comment to test the `overflow` attribute defined in CSS. The `overflow` property in CSS deals with the content when it overflows the block-level container. It can take the following values: `visible` (default), `hidden`, `scroll`, `auto`, and `clip`. // If `visible` is specified, the content is not clipped and can render outside the container. If `hidden` is specified, the content is clipped and the rest of the content will be invisible. If `scroll` is specified, the browser should provide a scrolling mechanism for the user to access the clipped content. } return 0; } ``` - - +{{< / highlight >}} diff --git a/exampleSiteMultilingual/content/posts/emoji-support.md b/exampleSiteMultilingual/content/posts/emoji-support.md index e16eeeb..119346a 100644 --- a/exampleSiteMultilingual/content/posts/emoji-support.md +++ b/exampleSiteMultilingual/content/posts/emoji-support.md @@ -9,7 +9,7 @@ tags = [ +++ Emoji can be enabled in a Hugo project in a number of ways. - + 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. diff --git a/exampleSiteMultilingual/content/posts/emoji-support.zh.md b/exampleSiteMultilingual/content/posts/emoji-support.zh.md index 3d449e1..5c11cf4 100644 --- a/exampleSiteMultilingual/content/posts/emoji-support.zh.md +++ b/exampleSiteMultilingual/content/posts/emoji-support.zh.md @@ -10,6 +10,8 @@ tags = [ 在 Hugo 博客里,你可以用多种方式使用 Emoji: + + 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. diff --git a/exampleSiteMultilingual/content/posts/markdown-syntax.md b/exampleSiteMultilingual/content/posts/markdown-syntax.md index 076acea..a092b24 100644 --- a/exampleSiteMultilingual/content/posts/markdown-syntax.md +++ b/exampleSiteMultilingual/content/posts/markdown-syntax.md @@ -20,7 +20,6 @@ favorite = true 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. - ## Headings diff --git a/exampleSiteMultilingual/content/posts/math-typesetting.md b/exampleSiteMultilingual/content/posts/math-typesetting.md index 29dbd1c..9d96925 100644 --- a/exampleSiteMultilingual/content/posts/math-typesetting.md +++ b/exampleSiteMultilingual/content/posts/math-typesetting.md @@ -2,15 +2,38 @@ author: Hugo Authors title: Math Typesetting date: 2019-03-08 -description: A brief guide to setup MathJax +description: A brief guide to setup KaTeX math: true --- Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries. + -- To enable MathJax on a page basis include the parameter `math: true` in content files. +In this example we will be using [KaTeX](https://katex.org/) -## Examples +- 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 }} + + + + +{{ end }} +{{}} + +### Examples Inline math: $$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$ diff --git a/exampleSiteMultilingual/content/posts/placeholder-text.md b/exampleSiteMultilingual/content/posts/placeholder-text.md index ac70ed6..1e9ee4e 100644 --- a/exampleSiteMultilingual/content/posts/placeholder-text.md +++ b/exampleSiteMultilingual/content/posts/placeholder-text.md @@ -31,7 +31,7 @@ tractus malis. 4. Arcanaque montibus omnes 5. Quidem et -## Vagus elidunt +# Vagus elidunt diff --git a/exampleSiteMultilingual/hugo.minimal.toml b/exampleSiteMultilingual/hugo.minimal.toml new file mode 100644 index 0000000..fe8cad0 --- /dev/null +++ b/exampleSiteMultilingual/hugo.minimal.toml @@ -0,0 +1,13 @@ +baseURL = "https://hugo-theme-anubis2.netlify.app/" +languageCode = "en-us" +theme = "anubis2" +title = "Anubis2 Demo Site" + +[params.author] +name = "Junyi" + +[markup.goldmark.renderer] +unsafe = true # true | false; Enable unsafe mode to have a better experience + +[markup.highlight] +style = 'base16-snazzy' # Highlight.js style diff --git a/exampleSiteMultilingual/hugo.toml b/exampleSiteMultilingual/hugo.toml index 58186d6..8a0757e 100644 --- a/exampleSiteMultilingual/hugo.toml +++ b/exampleSiteMultilingual/hugo.toml @@ -55,8 +55,7 @@ social = [ { id = "netease-music", url = "#" }, { id = "telegram", url = "#" }, { id = "x", url = "#" }, - { id = "youtube", url = "#" }, - { id = "bluesky", url = "#" } + { id = "youtube", url = "#" } ] [[menu.main]] @@ -156,13 +155,13 @@ author = "authors" defaultMarkdownHandler = 'goldmark' [markup.goldmark.renderer] -unsafe = true # Enable unsafe mode to have a better experience +unsafe = true [markup.highlight] anchorLineNos = false codeFences = true # tested with true and false. Both work. noClasses = true # If you run with markup.highlight.noClasses=false in your site configuration, you need a style sheet. -style = 'catppuccin-frappe' # Find more style at here: https://swapoff.org/chroma/playground/ +style = 'base16-snazzy' tabWidth = 4 [params.UmamiAnalytics] diff --git a/layouts/_default/single.html b/layouts/_default/single.html index c16b949..296faa9 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -53,10 +53,29 @@ */}} {{ if .Store.Get "hasMermaid" }} - {{ partial "mermaid_support.html" . }} - {{ end }} + {{ partial "resource.html" (dict "context" . "type" "js" "filename" "js/load-mermaid.js") }} - {{ if .Params.math }} - {{ partial "mathjax_support.html" . }} + {{ $colorTheme := "light" }} + {{ if and (site.Params.colortheme) (ne site.Params.colortheme "") }} + {{ $colorTheme = site.Params.colortheme | lower }} + {{ end }} + + {{ end }} {{ end }} diff --git a/layouts/index.html b/layouts/index.html index 9330ffd..f134cf2 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -8,7 +8,6 @@ {{ range (.Paginate $pages).Pages }} {{ partial "post-summary.html" . }} {{ end }} - {{ partial "pagination.html" . }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 61e1cb6..1126424 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -63,7 +63,7 @@ {{ with resources.Get . }} {{ $r = . }} {{ else }} - {{ errorf "error: You defined customCSS, but %s was not found in the local file system, please check your config." . }} + {{ errorf "error: You defined customCSS, but %s was not found, please check your config." . }} {{ end }} {{ if $r}} diff --git a/layouts/partials/mermaid_support.html b/layouts/partials/mermaid_support.html deleted file mode 100644 index f3f298f..0000000 --- a/layouts/partials/mermaid_support.html +++ /dev/null @@ -1,24 +0,0 @@ -{{ partial "resource.html" (dict "context" . "type" "js" "filename" "js/load-mermaid.js") }} - -{{ $colorTheme := "light" }} -{{ if and (site.Params.colortheme) (ne site.Params.colortheme "") }} -{{ $colorTheme = site.Params.colortheme | lower }} -{{ end }} - - diff --git a/layouts/partials/post-summary.html b/layouts/partials/post-summary.html index a9babeb..fd8fa8c 100644 --- a/layouts/partials/post-summary.html +++ b/layouts/partials/post-summary.html @@ -34,14 +34,6 @@ {{ i18n "readMore" }} {{ end }} - - {{ if .Store.Get "hasMermaid" }} - {{ partial "mermaid_support.html" . }} - {{ end }} - - {{ if .Params.math }} - {{ partial "mathjax_support.html" . }} - {{ end }} {{ partial "post-info.html" . }} diff --git a/layouts/partials/tabler-icons/bluesky.svg b/layouts/partials/tabler-icons/bluesky.svg deleted file mode 100644 index ff6869e..0000000 --- a/layouts/partials/tabler-icons/bluesky.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/netlify.toml b/netlify.toml index e72c944..c81d590 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ publish = "exampleSiteMultilingual/public" command = "cd exampleSiteMultilingual && hugo --themesDir=../.. --baseURL $URL" [build.environment] -HUGO_VERSION = "0.136.5" +HUGO_VERSION = "0.115.4" HUGO_THEME = "repo" [context.deploy-preview]