🎨 Code cleanup

This commit is contained in:
James Panther
2024-04-30 15:18:38 +10:00
parent afc163d812
commit 62a8c979b1
16 changed files with 61 additions and 56 deletions
@@ -49,7 +49,7 @@ Congo 针对完整的多语言网站进行了优化,并且主题assets中已
该主题目前支持以下语言:
| 语言 | 代码 |
| --------------------------------------- | ------- |
| ----------------------------- | ------- |
| :gb: **英语(默认)** | `en` |
| :egypt: 阿拉伯语 | `ar` |
| :bangladesh: 孟加拉语 | `bn` |
@@ -178,6 +178,7 @@ Congo 提供了大量的配置参数,用于控制主题的功能。下表概
|`verification.bing`|_未设置_|由 Bing 提供的要包含在站点元数据中的站点验证字符串。|
|`verification.pinterest`|_未设置_|由 Pinterest 提供的要包含在站点元数据中的站点验证字符串。|
|`verification.yandex`|_未设置_|由 Yandex 提供的要包含在站点元数据中的站点验证字符串。|
<!-- prettier-ignore-end -->
## 其他配置文件
+1 -1
View File
@@ -42,7 +42,7 @@ To enable Plausible analytics support, simply provide the domain of the website
### Umami Analytics
To enable support for Umami Analytics, insert the *tracking code token* provided by Umami into the `site` parameter to monitor the site. You can also insert a `region` parameter to indicate the region of Umami Analytics servers that you want to connect to. The values can be `eu` or `us`. Refer to [getting started section at umami.is](https://umami.is/docs/getting-started) for more details.
To enable support for Umami Analytics, insert the _tracking code token_ provided by Umami into the `site` parameter to monitor the site. You can also insert a `region` parameter to indicate the region of Umami Analytics servers that you want to connect to. The values can be `eu` or `us`. Refer to [getting started section at umami.is](https://umami.is/docs/getting-started) for more details.
```toml
# config/_default/params.toml
@@ -56,14 +56,14 @@ tags: ["markdown", "css", "html", "sample"]
表格不属于核心Markdown规范,但Hugo原生支持它们,无需额外配置。
| 名前 | 年齢 |
| ----- | --- |
| ----- | ---- |
| Bob | 27 |
| Alice | 23 |
### 表格内的行内Markdown
| 斜体 | 粗体 | 代码 |
| --------- | -------- | ------ |
| ------ | -------- | ------ |
| _斜体_ | **粗体** | `代码` |
## 代码块
@@ -71,7 +71,7 @@ tags: ["markdown", "css", "html", "sample"]
### 使用反引号的代码块
```html
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
+1 -1
View File
@@ -10,7 +10,7 @@
>
{{- partial "head.html" . -}}
<body
class="m-auto flex h-screen max-w-7xl flex-col bg-neutral px-6 text-lg leading-7 text-neutral-900 sm:px-14 md:px-24 lg:px-32 dark:bg-neutral-800 dark:text-neutral"
class="m-auto flex h-screen max-w-7xl flex-col bg-neutral px-6 text-lg leading-7 text-neutral-900 dark:bg-neutral-800 dark:text-neutral sm:px-14 md:px-24 lg:px-32"
>
<div id="the-top" class="absolute flex self-center">
<a
+4 -3
View File
@@ -15,10 +15,11 @@
{{- if isset . "region" }}
{{- $region = .region }}
{{- end }}
<script defer
<script
defer
src="https://{{ $region }}.umami.is/script.js"
data-website-id="{{ .site }}">
</script>
data-website-id="{{ .site }}"
></script>
{{ end }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}
+1 -1
View File
@@ -1,4 +1,4 @@
<ol class="text-sm text-neutral-500 print:hidden dark:text-neutral-400">
<ol class="text-sm text-neutral-500 dark:text-neutral-400 print:hidden">
{{ template "crumb" (dict "p1" . "p2" .) }}
</ol>
{{ define "crumb" }}
+1 -1
View File
@@ -1,4 +1,4 @@
<header class="py-6 font-semibold text-neutral-900 print:hidden sm:py-10 dark:text-neutral">
<header class="py-6 font-semibold text-neutral-900 dark:text-neutral sm:py-10 print:hidden">
<nav class="flex items-start justify-between sm:items-center">
{{/* Site logo/title */}}
<div class="flex flex-row items-center">
+1 -1
View File
@@ -1,4 +1,4 @@
<header class="py-6 font-semibold text-neutral-900 print:hidden sm:py-10 dark:text-neutral">
<header class="py-6 font-semibold text-neutral-900 dark:text-neutral sm:py-10 print:hidden">
<nav class="flex items-start justify-between sm:items-center">
{{/* Site logo/title */}}
<div class="z-40 flex flex-row items-center">
+1 -1
View File
@@ -1,4 +1,4 @@
<header class="py-6 font-semibold text-neutral-900 print:hidden sm:py-10 dark:text-neutral">
<header class="py-6 font-semibold text-neutral-900 dark:text-neutral sm:py-10 print:hidden">
<nav class="flex items-start justify-between sm:items-center">
{{/* Site logo/title */}}
<div class="z-40 flex flex-row items-center">
+1 -1
View File
@@ -1,6 +1,6 @@
<div
id="search-wrapper"
class="invisible fixed inset-0 z-50 flex h-screen w-screen cursor-default flex-col bg-neutral-500/50 p-4 backdrop-blur-sm sm:p-6 md:p-[10vh] lg:p-[12vh] dark:bg-neutral-900/50"
class="invisible fixed inset-0 z-50 flex h-screen w-screen cursor-default flex-col bg-neutral-500/50 p-4 backdrop-blur-sm dark:bg-neutral-900/50 sm:p-6 md:p-[10vh] lg:p-[12vh]"
data-url="{{ "" | absLangURL }}"
>
<div
+7 -4
View File
@@ -1,7 +1,7 @@
const jsdom = require("jsdom");
const fs = require("fs");
const SVG_FILE_DIR = 'node_modules/@fortawesome/fontawesome-free/svgs/brands';
const SVG_FILE_DIR = "node_modules/@fortawesome/fontawesome-free/svgs/brands";
const DOC_DIR = "./exampleSite/content/samples/icons";
const DEFAULT_TABLE_DELIMITER = "| -------------------- | --------------------------------- |";
@@ -72,7 +72,10 @@ const add_documentation = async (icon_name) => {
*/
const process_file = (file_contents, icon_name) => {
const [headers, table] = file_contents.split(DEFAULT_TABLE_DELIMITER);
const table_rows = table.split("\n").map((x) => x.trim()).filter((row) => row !== "");
const table_rows = table
.split("\n")
.map((x) => x.trim())
.filter((row) => row !== "");
table_rows.push(create_table_row(icon_name));
table_rows.sort();
const new_table = table_rows.join("\n");
@@ -80,8 +83,8 @@ const process_file = (file_contents, icon_name) => {
};
const create_table_row = (name) => {
return `| ${name} | {{< icon ${name} >}} |`
}
return `| ${name} | {{< icon ${name} >}} |`;
};
const get_md_docs = () => {
return fs.readdirSync(DOC_DIR).filter((file) => file.endsWith(".md"));