From 3a998b4598e551f398ba66c1c1d1be4b10db306e Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Mon, 25 Dec 2023 22:17:25 +0900 Subject: [PATCH 01/73] feat: add script to auto update icons --- scripts/update_icon.py | 127 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 scripts/update_icon.py diff --git a/scripts/update_icon.py b/scripts/update_icon.py new file mode 100644 index 000000000..a7159b06f --- /dev/null +++ b/scripts/update_icon.py @@ -0,0 +1,127 @@ +import argparse +import bs4 +import re +import logging +import requests +import os + +from typing import Tuple + + +DEFAULT_FONTAWESOME_VERSION = "v6.5.1" +DEFAULT_BASE_URL = ( + "https://site-assets.fontawesome.com/releases/%s/svgs/brands/" + % DEFAULT_FONTAWESOME_VERSION + + "%s.svg" +) +DEFAULT_ICON_PATH = os.path.join( + os.getcwd(), + "..", + "assets", + "icons", +) +DEFAULT_SVG_ATTR = {"fill": "currentColor"} + + +def download_icon(download_url: str) -> None: + """Downloads the icon based on the URL""" + with requests.Session() as s: + return s.get(download_url).content + + +def update_svg_to_theme(svg: bytes) -> bytes: + """Update the current color of SVG to match theme""" + soup = bs4.BeautifulSoup(svg, features="html.parser") + + # Update attrs + svg_elem = soup.find("svg").find("path") + for k, v in DEFAULT_SVG_ATTR.items(): + svg_elem[k] = v + + # Remove comments + return re.sub(r'','', str(soup)) + + + +def save_file(name: str, svg: str) -> None: + file_name = f"{name}.svg" + logging.debug(f"saving icon to {file_name}") + with open( + os.path.join( + DEFAULT_ICON_PATH, + file_name, + ), + "w", + ) as file: + file.write(svg) + + +def parse_args() -> Tuple[str, str, int]: + """ + Parse arguments. + Returns the following: + 1. Icon URL: str + 2. Icon Representation :str + 3. Log Level: int + """ + parser = argparse.ArgumentParser() + parser.add_argument( + "-v", + "--verbose", + help="show debug messages during script execution", + required=False, + default=False, + action="store_true", + ) + + parser.add_argument( + "-u", + "--url", + help="full url of the icon svg, defaults to fortawesome url", + required=False, + nargs=1, + ) + + parser.add_argument( + "name", + help="name of the icon to be added. EG: `github`", + ) + + parse_res = parser.parse_args() + url = DEFAULT_BASE_URL % parse_res.name + if parse_res.url is not None: + if len(parse_res.url) != 1: + raise ValueError("Invalid URL arguments. Use -h for help.") + url = parse_res.url[0] + + log_level = logging.DEBUG if parse_res.verbose else logging.INFO + return url, parse_res.name, log_level + + +if __name__ == "__main__": + icon_url, icon_name, log_level = parse_args() + + # Setup logging + logging.basicConfig( + level=log_level, + format="%(asctime)s.%(msecs)03d %(levelname)s %(module)s - %(funcName)s: %(message)s", + datefmt="%Y-%m-%d %H:%M:%S", + ) + logging.debug(f"Using default base URL: {DEFAULT_BASE_URL}") + logging.info(f"Using Log Level: {logging.getLevelName(log_level)}") + logging.info(f"Using URL: {icon_url}") + logging.info(f"Using Icon Name: {icon_name}") + + # Download Icon + logging.debug(f"fetching icon at {icon_url}") + svg_content = download_icon(icon_url) + + # Patch svg attrs + logging.debug(f"updating svg attrs") + final_svg = update_svg_to_theme(svg_content) + + # Save file + logging.debug("saving icon to assets") + save_file(icon_name, final_svg) + + # Write to docs (TODO) From eb527de54bb989bf1938dc09e402710f4594bc33 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Mon, 25 Dec 2023 23:13:32 +0900 Subject: [PATCH 02/73] feat: add docs update --- scripts/update_icon.py | 63 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/scripts/update_icon.py b/scripts/update_icon.py index a7159b06f..2b52319e6 100644 --- a/scripts/update_icon.py +++ b/scripts/update_icon.py @@ -5,7 +5,7 @@ import requests import os -from typing import Tuple +from typing import Tuple, List DEFAULT_FONTAWESOME_VERSION = "v6.5.1" @@ -14,13 +14,17 @@ % DEFAULT_FONTAWESOME_VERSION + "%s.svg" ) +DEFAULT_BASE_PATH = os.path.join(os.getcwd(), "..") DEFAULT_ICON_PATH = os.path.join( - os.getcwd(), - "..", + DEFAULT_BASE_PATH, "assets", "icons", ) DEFAULT_SVG_ATTR = {"fill": "currentColor"} +DEFAULT_ICON_DOCS = os.path.join( + DEFAULT_BASE_PATH, "exampleSite", "content", "samples", "icons" +) +DEFAULT_TABLE_DELIMITER = "| -------------------- | --------------------------------- |" def download_icon(download_url: str) -> None: @@ -39,9 +43,56 @@ def update_svg_to_theme(svg: bytes) -> bytes: svg_elem[k] = v # Remove comments - return re.sub(r'','', str(soup)) + return re.sub(r"", "", str(soup)) + + +def update_docs(icon_name: str) -> None: + """Update icon to docs""" + files = get_folder_md(DEFAULT_ICON_DOCS) + for file in files: + # Parse Table + logging.debug(f"reading {file}") + with open(file) as f: + file_data = f.read() + table_fmt, table = parse_table(file_data) + table.append(str(table[0]).replace("amazon", icon_name)) + + # Write Doc + print(table_fmt) + with open(file, "w") as f: + f.write( + "\n".join( + ( + table_fmt, + DEFAULT_TABLE_DELIMITER, + "\n".join(sorted(table)), + ) + ) + ) + + +def get_folder_md(dir_path: str) -> List[str]: + return list( + map( + lambda path: os.path.join(dir_path, path), + filter(lambda x: x.endswith(".md"), os.listdir(dir_path)), + ) + ) +def parse_table(table_str: str) -> Tuple[str, List[str]]: + """Parse the table to a list of (article_fmt, (icon_name, icon_shortcode))""" + headers, table = table_str.split(DEFAULT_TABLE_DELIMITER) + return headers.strip(), list( + filter( + lambda x: len(x.strip()) > 0, + map( + lambda x: x.strip(), + table.split("\n"), + ), + ) + ) + def save_file(name: str, svg: str) -> None: file_name = f"{name}.svg" @@ -125,3 +176,7 @@ def parse_args() -> Tuple[str, str, int]: save_file(icon_name, final_svg) # Write to docs (TODO) + logging.debug("updating") + update_docs(icon_name) + + logging.info("done!") From 3c81e00bedd9463c64b358a28678f3ed5f44f892 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Mon, 25 Dec 2023 23:17:40 +0900 Subject: [PATCH 03/73] chore: clean up code --- scripts/update_icon.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/update_icon.py b/scripts/update_icon.py index 2b52319e6..ccb76877f 100644 --- a/scripts/update_icon.py +++ b/scripts/update_icon.py @@ -15,7 +15,7 @@ + "%s.svg" ) DEFAULT_BASE_PATH = os.path.join(os.getcwd(), "..") -DEFAULT_ICON_PATH = os.path.join( +DEFAULT_ICON_DIR_PATH = os.path.join( DEFAULT_BASE_PATH, "assets", "icons", @@ -99,7 +99,7 @@ def save_file(name: str, svg: str) -> None: logging.debug(f"saving icon to {file_name}") with open( os.path.join( - DEFAULT_ICON_PATH, + DEFAULT_ICON_DIR_PATH, file_name, ), "w", @@ -141,8 +141,6 @@ def parse_args() -> Tuple[str, str, int]: parse_res = parser.parse_args() url = DEFAULT_BASE_URL % parse_res.name if parse_res.url is not None: - if len(parse_res.url) != 1: - raise ValueError("Invalid URL arguments. Use -h for help.") url = parse_res.url[0] log_level = logging.DEBUG if parse_res.verbose else logging.INFO @@ -175,7 +173,7 @@ def parse_args() -> Tuple[str, str, int]: logging.debug("saving icon to assets") save_file(icon_name, final_svg) - # Write to docs (TODO) + # Write to docs logging.debug("updating") update_docs(icon_name) From db07288d0128a5504f680cd19e64430d44eb507d Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Mon, 25 Dec 2023 23:24:47 +0900 Subject: [PATCH 04/73] chore: clean up code --- scripts/update_icon.py | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/scripts/update_icon.py b/scripts/update_icon.py index ccb76877f..22450a6f1 100644 --- a/scripts/update_icon.py +++ b/scripts/update_icon.py @@ -21,7 +21,7 @@ "icons", ) DEFAULT_SVG_ATTR = {"fill": "currentColor"} -DEFAULT_ICON_DOCS = os.path.join( +DEFAULT_ICON_DOCS_DIR = os.path.join( DEFAULT_BASE_PATH, "exampleSite", "content", "samples", "icons" ) DEFAULT_TABLE_DELIMITER = "| -------------------- | --------------------------------- |" @@ -48,7 +48,7 @@ def update_svg_to_theme(svg: bytes) -> bytes: def update_docs(icon_name: str) -> None: """Update icon to docs""" - files = get_folder_md(DEFAULT_ICON_DOCS) + files = get_folder_md(DEFAULT_ICON_DOCS_DIR) for file in files: # Parse Table logging.debug(f"reading {file}") @@ -58,7 +58,6 @@ def update_docs(icon_name: str) -> None: table.append(str(table[0]).replace("amazon", icon_name)) # Write Doc - print(table_fmt) with open(file, "w") as f: f.write( "\n".join( @@ -161,20 +160,25 @@ def parse_args() -> Tuple[str, str, int]: logging.info(f"Using URL: {icon_url}") logging.info(f"Using Icon Name: {icon_name}") - # Download Icon - logging.debug(f"fetching icon at {icon_url}") - svg_content = download_icon(icon_url) + try: + # Download Icon + logging.debug(f"fetching icon at {icon_url}") + svg_content = download_icon(icon_url) - # Patch svg attrs - logging.debug(f"updating svg attrs") - final_svg = update_svg_to_theme(svg_content) - - # Save file - logging.debug("saving icon to assets") - save_file(icon_name, final_svg) - - # Write to docs - logging.debug("updating") - update_docs(icon_name) - - logging.info("done!") + # Patch svg attrs + logging.debug( + f"remove svg comments and update svg attrs with {DEFAULT_SVG_ATTR}" + ) + final_svg = update_svg_to_theme(svg_content) + + # Save file + logging.debug(f"saving icon to {DEFAULT_ICON_DIR_PATH}") + save_file(icon_name, final_svg) + + # Write to docs + logging.debug(f"updating docs from {DEFAULT_ICON_DOCS_DIR} dir") + update_docs(icon_name) + except Exception as e: + logging.critical(f"error adding icon {str(e)}") + else: + logging.info(f"{icon_name} added successfully") From 679898570c8c1d09c2e2312ca19ad1bc4201902b Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Mon, 25 Dec 2023 23:27:14 +0900 Subject: [PATCH 05/73] docs: update script docs --- scripts/update_icon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update_icon.py b/scripts/update_icon.py index 22450a6f1..246641013 100644 --- a/scripts/update_icon.py +++ b/scripts/update_icon.py @@ -114,7 +114,7 @@ def parse_args() -> Tuple[str, str, int]: 2. Icon Representation :str 3. Log Level: int """ - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser(description="This script adds an icon to this congo theme and updates the relevant documentation.") parser.add_argument( "-v", "--verbose", From 97a3f0064c5cc7ba7fad122171d40bcc9bdd1183 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Sun, 31 Dec 2023 13:24:02 +0800 Subject: [PATCH 06/73] feat: port script to node --- package-lock.json | 743 ++++++++++++++++++++++++++++++++++++++++- package.json | 4 +- scripts/index.js | 11 + scripts/update_icon.js | 98 ++++++ scripts/update_icon.py | 184 ---------- 5 files changed, 841 insertions(+), 199 deletions(-) create mode 100644 scripts/index.js create mode 100644 scripts/update_icon.js delete mode 100644 scripts/update_icon.py diff --git a/package-lock.json b/package-lock.json index b9ff1cc0c..4e00ef91f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@tailwindcss/typography": "^0.5.10", "chart.js": "^4.4.1", "fuse.js": "^7.0.0", + "jsdom": "^23.0.1", "katex": "^0.16.9", "mermaid": "^10.6.1", "prettier": "^3.1.1", @@ -233,6 +234,18 @@ "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==", "dev": true }, + "node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dev": true, + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/ansi-regex": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", @@ -282,6 +295,12 @@ "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", "dev": true }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -406,6 +425,18 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", @@ -456,6 +487,18 @@ "node": ">=4" } }, + "node_modules/cssstyle": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz", + "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==", + "dev": true, + "dependencies": { + "rrweb-cssom": "^0.6.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/cytoscape": { "version": "3.23.0", "resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.23.0.tgz", @@ -968,6 +1011,19 @@ "lodash-es": "^4.17.21" } }, + "node_modules/data-urls": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", + "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", + "dev": true, + "dependencies": { + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/dayjs": { "version": "1.11.7", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz", @@ -991,6 +1047,12 @@ } } }, + "node_modules/decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", + "dev": true + }, "node_modules/decode-named-character-reference": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", @@ -1013,6 +1075,15 @@ "robust-predicates": "^3.0.0" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -1067,6 +1138,18 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/fast-glob": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", @@ -1132,6 +1215,20 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1219,6 +1316,44 @@ "integrity": "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==", "dev": true }, + "node_modules/html-encoding-sniffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", + "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", + "dev": true, + "dependencies": { + "whatwg-encoding": "^3.1.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", + "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "dev": true, + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "dev": true, + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -1319,6 +1454,12 @@ "node": ">=0.12.0" } }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -1359,6 +1500,46 @@ "dev": true, "peer": true }, + "node_modules/jsdom": { + "version": "23.0.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-23.0.1.tgz", + "integrity": "sha512-2i27vgvlUsGEBO9+/kJQRbtqtm+191b5zAZrU/UezVmnC2dlDAFLgDYJvAEi94T4kjsRKkezEtLQTgsNEsW2lQ==", + "dev": true, + "dependencies": { + "cssstyle": "^3.0.0", + "data-urls": "^5.0.0", + "decimal.js": "^10.4.3", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^4.0.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.7", + "parse5": "^7.1.2", + "rrweb-cssom": "^0.6.0", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.3", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^3.1.1", + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0", + "ws": "^8.14.2", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "canvas": "^2.11.2" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, "node_modules/katex": { "version": "0.16.9", "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.9.tgz", @@ -1993,6 +2174,27 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimatch": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", @@ -2044,9 +2246,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "dev": true, "funding": [ { @@ -2085,6 +2287,12 @@ "node": ">=0.10.0" } }, + "node_modules/nwsapi": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", + "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", + "dev": true + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -2112,6 +2320,18 @@ "wrappy": "1" } }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -2189,9 +2409,9 @@ } }, "node_modules/postcss": { - "version": "8.4.23", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz", - "integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==", + "version": "8.4.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz", + "integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==", "dev": true, "funding": [ { @@ -2208,7 +2428,7 @@ } ], "dependencies": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -2443,6 +2663,27 @@ "react-is": "^16.13.1" } }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", + "dev": true + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -2545,6 +2786,12 @@ "node": ">=6" } }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, "node_modules/resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", @@ -2608,6 +2855,12 @@ "node": ">= 6" } }, + "node_modules/rrweb-cssom": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", + "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==", + "dev": true + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -2655,6 +2908,18 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, "node_modules/scheduler": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", @@ -2895,6 +3160,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true + }, "node_modules/tailwindcss": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.0.tgz", @@ -2987,6 +3258,33 @@ "node": ">=8.0" } }, + "node_modules/tough-cookie": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "dev": true, + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz", + "integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==", + "dev": true, + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/ts-dedent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-2.2.0.tgz", @@ -3024,6 +3322,25 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -3072,12 +3389,67 @@ "node": ">=12" } }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/web-worker": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.2.0.tgz", "integrity": "sha512-PgF341avzqyx60neE9DD+XS26MMNMoUQRz9NOZwW32nPQrF6p77f1htcnjBSEV8BGMKZ16choqUG4hyI0Hx7mA==", "dev": true }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "dev": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-url": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.0.0.tgz", + "integrity": "sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==", + "dev": true, + "dependencies": { + "tr46": "^5.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3190,6 +3562,42 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, + "node_modules/ws": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true + }, "node_modules/yaml": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.2.tgz", @@ -3376,6 +3784,15 @@ "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==", "dev": true }, + "agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dev": true, + "requires": { + "debug": "^4.3.4" + } + }, "ansi-regex": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", @@ -3410,6 +3827,12 @@ "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -3503,6 +3926,15 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", @@ -3541,6 +3973,15 @@ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "dev": true }, + "cssstyle": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz", + "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==", + "dev": true, + "requires": { + "rrweb-cssom": "^0.6.0" + } + }, "cytoscape": { "version": "3.23.0", "resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.23.0.tgz", @@ -3940,6 +4381,16 @@ "lodash-es": "^4.17.21" } }, + "data-urls": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", + "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", + "dev": true, + "requires": { + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0" + } + }, "dayjs": { "version": "1.11.7", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz", @@ -3955,6 +4406,12 @@ "ms": "2.1.2" } }, + "decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", + "dev": true + }, "decode-named-character-reference": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", @@ -3973,6 +4430,12 @@ "robust-predicates": "^3.0.0" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true + }, "dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -4021,6 +4484,12 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, + "entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true + }, "fast-glob": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", @@ -4073,6 +4542,17 @@ "signal-exit": "^4.0.1" } }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -4135,6 +4615,35 @@ "integrity": "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==", "dev": true }, + "html-encoding-sniffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", + "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", + "dev": true, + "requires": { + "whatwg-encoding": "^3.1.1" + } + }, + "http-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", + "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "dev": true, + "requires": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + } + }, + "https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "dev": true, + "requires": { + "agent-base": "^7.0.2", + "debug": "4" + } + }, "iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -4211,6 +4720,12 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -4240,6 +4755,35 @@ "dev": true, "peer": true }, + "jsdom": { + "version": "23.0.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-23.0.1.tgz", + "integrity": "sha512-2i27vgvlUsGEBO9+/kJQRbtqtm+191b5zAZrU/UezVmnC2dlDAFLgDYJvAEi94T4kjsRKkezEtLQTgsNEsW2lQ==", + "dev": true, + "requires": { + "cssstyle": "^3.0.0", + "data-urls": "^5.0.0", + "decimal.js": "^10.4.3", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^4.0.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.7", + "parse5": "^7.1.2", + "rrweb-cssom": "^0.6.0", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.3", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^3.1.1", + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0", + "ws": "^8.14.2", + "xml-name-validator": "^5.0.0" + } + }, "katex": { "version": "0.16.9", "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.9.tgz", @@ -4631,6 +5175,21 @@ "picomatch": "^2.3.1" } }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "requires": { + "mime-db": "1.52.0" + } + }, "minimatch": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", @@ -4670,9 +5229,9 @@ } }, "nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "dev": true }, "ncp": { @@ -4693,6 +5252,12 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "nwsapi": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", + "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", + "dev": true + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -4714,6 +5279,15 @@ "wrappy": "1" } }, + "parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "requires": { + "entities": "^4.4.0" + } + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -4767,12 +5341,12 @@ "dev": true }, "postcss": { - "version": "8.4.23", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz", - "integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==", + "version": "8.4.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz", + "integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==", "dev": true, "requires": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } @@ -4878,6 +5452,24 @@ "react-is": "^16.13.1" } }, + "psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", + "dev": true + }, + "punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true + }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true + }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -4950,6 +5542,12 @@ "integrity": "sha512-6IQpFBv6e5vz1QAqI+V4k8P2e/3gRrqfCJ9FI+O1FLQTO+Uz6RXZEZOPmTJ6hlGj7gkERzY5BRCv09whKP96/g==", "dev": true }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, "resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", @@ -4991,6 +5589,12 @@ "regexparam": "^1.3.0" } }, + "rrweb-cssom": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", + "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==", + "dev": true + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -5021,6 +5625,15 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "requires": { + "xmlchars": "^2.2.0" + } + }, "scheduler": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", @@ -5198,6 +5811,12 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true }, + "symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true + }, "tailwindcss": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.0.tgz", @@ -5273,6 +5892,27 @@ "is-number": "^7.0.0" } }, + "tough-cookie": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "dev": true, + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + } + }, + "tr46": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz", + "integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==", + "dev": true, + "requires": { + "punycode": "^2.3.1" + } + }, "ts-dedent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-2.2.0.tgz", @@ -5300,6 +5940,22 @@ "@types/unist": "^2.0.0" } }, + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "dev": true + }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -5333,12 +5989,52 @@ "ncp": "^2.0.0" } }, + "w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "requires": { + "xml-name-validator": "^5.0.0" + } + }, "web-worker": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.2.0.tgz", "integrity": "sha512-PgF341avzqyx60neE9DD+XS26MMNMoUQRz9NOZwW32nPQrF6p77f1htcnjBSEV8BGMKZ16choqUG4hyI0Hx7mA==", "dev": true }, + "webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true + }, + "whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "dev": true, + "requires": { + "iconv-lite": "0.6.3" + } + }, + "whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true + }, + "whatwg-url": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.0.0.tgz", + "integrity": "sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==", + "dev": true, + "requires": { + "tr46": "^5.0.0", + "webidl-conversions": "^7.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -5419,6 +6115,25 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, + "ws": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "dev": true, + "requires": {} + }, + "xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true + }, + "xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true + }, "yaml": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.2.tgz", diff --git a/package.json b/package.json index 14199a2d7..ce6e01c4c 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "dev": "NODE_ENV=development ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit -w", "build": "NODE_ENV=production ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit", "example": "hugo server --bind 0.0.0.0 -p 8008 --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/congo/ ", - "lighthouse": "lhci autorun" + "lighthouse": "lhci autorun", + "add-icon": "node scripts/index.js add-icon" }, "repository": { "type": "git", @@ -32,6 +33,7 @@ "@tailwindcss/typography": "^0.5.10", "chart.js": "^4.4.1", "fuse.js": "^7.0.0", + "jsdom": "^23.0.1", "katex": "^0.16.9", "mermaid": "^10.6.1", "prettier": "^3.1.1", diff --git a/scripts/index.js b/scripts/index.js new file mode 100644 index 000000000..a22fb4aef --- /dev/null +++ b/scripts/index.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node +const { program } = require("commander"); +const { add_icon_to_congo } = require("./update_icon"); + +// Adds an icon to the project. +program + .command("add-icon ") + .description("Add icon to the project") + .action(add_icon_to_congo); + +program.parse(process.argv); diff --git a/scripts/update_icon.js b/scripts/update_icon.js new file mode 100644 index 000000000..fe64f3c72 --- /dev/null +++ b/scripts/update_icon.js @@ -0,0 +1,98 @@ +const jsdom = require("jsdom"); +const fs = require("fs"); + +const DOC_DIR = "./exampleSite/content/samples/icons"; +const FONTAWESOME_VERSION = "v6.5.1"; +const DEFAULT_TABLE_DELIMITER = "| -------------------- | --------------------------------- |"; + +/** + * Saves an icon to the congo project and update documentation. + * @param {string} icon_name Icon name from Font Awesome to download + * @returns null + */ +const add_icon_to_congo = async (icon_name) => { + try { + const icon_url = create_icon_url(icon_name, FONTAWESOME_VERSION); + const file = await get_file(icon_url); + const final_svg = modify_svg_string(file); + const icon_download_path = create_icon_download_path(icon_name); + save_file(icon_download_path, final_svg); + add_documentation(icon_name); + } catch (e) { + console.log(e); + return; + } +}; + +const modify_svg_string = (svg_string) => { + try { + dom = new jsdom.JSDOM(svg_string); + svg = dom.window.document.documentElement.querySelector("svg"); + svg.querySelector("path").setAttribute("fill", "currentColor"); + return svg.outerHTML; + } catch (e) { + throw new Error("Invalid SVG file"); + } +}; + +const create_icon_url = (icon_name, fontawesome_version) => { + return `https://site-assets.fontawesome.com/releases/${fontawesome_version}/svgs/brands/${icon_name}.svg`; +}; + +const create_icon_download_path = (icon_name) => { + return `./assets/icons/${icon_name}.svg`; +}; + +const get_file = async (url) => { + console.log("Getting file at " + url + "..."); + const response = await fetch(url); + if (response.status >= 400) { + throw new Error("Could not download icon / icon not found"); + } + return response.text(); +}; + +const save_file = (file_path, file) => { + console.log("Saving file at " + file_path + "..."); + fs.writeFile(file_path, file, function (err) { + if (err) throw err; + console.log("File saved!"); + }); +}; + +const add_documentation = async (icon_name) => { + files = get_md_docs(); + + for (const file of files) { + const file_path = `${DOC_DIR}/${file}`; + const file_contents = fs.readFileSync(file_path, "utf8"); + const file_result = process_file(file_contents, icon_name); + console.log(file_result); + // Save file_result to file_path + fs.writeFile(file_path, file_result, function (err) { + if (err) throw err; + }); + console.log(`Updated ${file_path}`); + } +}; + +/** + * Process the file contents to include the icon name. + * @param {string} file_contents contents of the documentation files. + * @returns {string} processed file contents. + */ +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 !== ""); + console.log(table_rows); + table_rows.push(table_rows[0].replace("amazon", icon_name)); + table_rows.sort(); + const new_table = table_rows.join("\n"); + return `${headers.trimEnd()}\n${DEFAULT_TABLE_DELIMITER}\n${new_table}\n`; +}; + +const get_md_docs = () => { + return fs.readdirSync(DOC_DIR).filter((file) => file.endsWith(".md")); +}; + +module.exports = { add_icon_to_congo }; diff --git a/scripts/update_icon.py b/scripts/update_icon.py deleted file mode 100644 index 246641013..000000000 --- a/scripts/update_icon.py +++ /dev/null @@ -1,184 +0,0 @@ -import argparse -import bs4 -import re -import logging -import requests -import os - -from typing import Tuple, List - - -DEFAULT_FONTAWESOME_VERSION = "v6.5.1" -DEFAULT_BASE_URL = ( - "https://site-assets.fontawesome.com/releases/%s/svgs/brands/" - % DEFAULT_FONTAWESOME_VERSION - + "%s.svg" -) -DEFAULT_BASE_PATH = os.path.join(os.getcwd(), "..") -DEFAULT_ICON_DIR_PATH = os.path.join( - DEFAULT_BASE_PATH, - "assets", - "icons", -) -DEFAULT_SVG_ATTR = {"fill": "currentColor"} -DEFAULT_ICON_DOCS_DIR = os.path.join( - DEFAULT_BASE_PATH, "exampleSite", "content", "samples", "icons" -) -DEFAULT_TABLE_DELIMITER = "| -------------------- | --------------------------------- |" - - -def download_icon(download_url: str) -> None: - """Downloads the icon based on the URL""" - with requests.Session() as s: - return s.get(download_url).content - - -def update_svg_to_theme(svg: bytes) -> bytes: - """Update the current color of SVG to match theme""" - soup = bs4.BeautifulSoup(svg, features="html.parser") - - # Update attrs - svg_elem = soup.find("svg").find("path") - for k, v in DEFAULT_SVG_ATTR.items(): - svg_elem[k] = v - - # Remove comments - return re.sub(r"", "", str(soup)) - - -def update_docs(icon_name: str) -> None: - """Update icon to docs""" - files = get_folder_md(DEFAULT_ICON_DOCS_DIR) - for file in files: - # Parse Table - logging.debug(f"reading {file}") - with open(file) as f: - file_data = f.read() - table_fmt, table = parse_table(file_data) - table.append(str(table[0]).replace("amazon", icon_name)) - - # Write Doc - with open(file, "w") as f: - f.write( - "\n".join( - ( - table_fmt, - DEFAULT_TABLE_DELIMITER, - "\n".join(sorted(table)), - ) - ) - ) - - -def get_folder_md(dir_path: str) -> List[str]: - return list( - map( - lambda path: os.path.join(dir_path, path), - filter(lambda x: x.endswith(".md"), os.listdir(dir_path)), - ) - ) - - -def parse_table(table_str: str) -> Tuple[str, List[str]]: - """Parse the table to a list of (article_fmt, (icon_name, icon_shortcode))""" - headers, table = table_str.split(DEFAULT_TABLE_DELIMITER) - return headers.strip(), list( - filter( - lambda x: len(x.strip()) > 0, - map( - lambda x: x.strip(), - table.split("\n"), - ), - ) - ) - - -def save_file(name: str, svg: str) -> None: - file_name = f"{name}.svg" - logging.debug(f"saving icon to {file_name}") - with open( - os.path.join( - DEFAULT_ICON_DIR_PATH, - file_name, - ), - "w", - ) as file: - file.write(svg) - - -def parse_args() -> Tuple[str, str, int]: - """ - Parse arguments. - Returns the following: - 1. Icon URL: str - 2. Icon Representation :str - 3. Log Level: int - """ - parser = argparse.ArgumentParser(description="This script adds an icon to this congo theme and updates the relevant documentation.") - parser.add_argument( - "-v", - "--verbose", - help="show debug messages during script execution", - required=False, - default=False, - action="store_true", - ) - - parser.add_argument( - "-u", - "--url", - help="full url of the icon svg, defaults to fortawesome url", - required=False, - nargs=1, - ) - - parser.add_argument( - "name", - help="name of the icon to be added. EG: `github`", - ) - - parse_res = parser.parse_args() - url = DEFAULT_BASE_URL % parse_res.name - if parse_res.url is not None: - url = parse_res.url[0] - - log_level = logging.DEBUG if parse_res.verbose else logging.INFO - return url, parse_res.name, log_level - - -if __name__ == "__main__": - icon_url, icon_name, log_level = parse_args() - - # Setup logging - logging.basicConfig( - level=log_level, - format="%(asctime)s.%(msecs)03d %(levelname)s %(module)s - %(funcName)s: %(message)s", - datefmt="%Y-%m-%d %H:%M:%S", - ) - logging.debug(f"Using default base URL: {DEFAULT_BASE_URL}") - logging.info(f"Using Log Level: {logging.getLevelName(log_level)}") - logging.info(f"Using URL: {icon_url}") - logging.info(f"Using Icon Name: {icon_name}") - - try: - # Download Icon - logging.debug(f"fetching icon at {icon_url}") - svg_content = download_icon(icon_url) - - # Patch svg attrs - logging.debug( - f"remove svg comments and update svg attrs with {DEFAULT_SVG_ATTR}" - ) - final_svg = update_svg_to_theme(svg_content) - - # Save file - logging.debug(f"saving icon to {DEFAULT_ICON_DIR_PATH}") - save_file(icon_name, final_svg) - - # Write to docs - logging.debug(f"updating docs from {DEFAULT_ICON_DOCS_DIR} dir") - update_docs(icon_name) - except Exception as e: - logging.critical(f"error adding icon {str(e)}") - else: - logging.info(f"{icon_name} added successfully") From 2cf1371c3e60530089e2f31191d2f13451ca6c5e Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Sun, 31 Dec 2023 13:26:09 +0800 Subject: [PATCH 07/73] fix: remove debug logs --- scripts/update_icon.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/update_icon.js b/scripts/update_icon.js index fe64f3c72..2dbe43bec 100644 --- a/scripts/update_icon.js +++ b/scripts/update_icon.js @@ -49,6 +49,7 @@ const get_file = async (url) => { if (response.status >= 400) { throw new Error("Could not download icon / icon not found"); } + console.log("File retrieved!"); return response.text(); }; @@ -67,7 +68,6 @@ const add_documentation = async (icon_name) => { const file_path = `${DOC_DIR}/${file}`; const file_contents = fs.readFileSync(file_path, "utf8"); const file_result = process_file(file_contents, icon_name); - console.log(file_result); // Save file_result to file_path fs.writeFile(file_path, file_result, function (err) { if (err) throw err; @@ -84,7 +84,6 @@ 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 !== ""); - console.log(table_rows); table_rows.push(table_rows[0].replace("amazon", icon_name)); table_rows.sort(); const new_table = table_rows.join("\n"); From 62d4d4112cc808c0d306762ce029704402e3b0fd Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Tue, 6 Feb 2024 23:16:47 +0800 Subject: [PATCH 08/73] feat: add js to check height and decide if to top is required --- assets/js/appearance.js | 15 +++++++++++++++ layouts/_default/baseof.html | 26 ++++++++++++++------------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/assets/js/appearance.js b/assets/js/appearance.js index dd5ad69d1..15f0eed89 100644 --- a/assets/js/appearance.js +++ b/assets/js/appearance.js @@ -38,7 +38,22 @@ if (document.documentElement.getAttribute("data-auto-appearance") === "true") { }); } +function add_to_top_elem() { + var body = document.body, + html = document.documentElement; + + const height = Math.max( + body.scrollHeight, + body.offsetHeight, + html.clientHeight, + html.scrollHeight, + html.offsetHeight + ) - 150; + document.getElementById("to-top").hidden = height < window.innerHeight; +} + window.addEventListener("DOMContentLoaded", (event) => { + add_to_top_elem(); var switchers = document.querySelectorAll("[id^='appearance-switcher']"); switchers.forEach((switcher) => { switcher.addEventListener("click", () => { diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 4f492147e..7be938ab9 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -29,18 +29,20 @@
{{ block "main" . }}{{ end }} - {{ if and (.Site.Params.footer.showScrollToTop | default true) (gt .WordCount 200) }} - - {{ end }} +
{{- partial "footer.html" . -}} {{ if .Site.Params.enableSearch | default false }} From 7475198f869a2a9880de1a276fd9d2d7c9055584 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Sat, 9 Mar 2024 12:32:04 +0800 Subject: [PATCH 09/73] feat: make the script offline --- package-lock.json | 21 +++++++++++++++++++-- package.json | 5 ++++- scripts/update_icon.js | 25 +++++++++---------------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 31fe5eebb..17a56b980 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,17 @@ { "name": "hugo-congo-theme", - "version": "2.7.6", + "version": "2.8.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "hugo-congo-theme", - "version": "2.7.6", + "version": "2.8.0", "hasInstallScript": true, "license": "MIT", + "dependencies": { + "@fortawesome/fontawesome-free": "^6.5.1" + }, "devDependencies": { "@tailwindcss/typography": "^0.5.10", "chart.js": "^4.4.1", @@ -46,6 +49,15 @@ "integrity": "sha512-Tbsj02wXCbqGmzdnXNk0SOF19ChhRU70BsroIi4Pm6Ehp56in6vch94mfbdQ17DozxkL3BAVjbZ4Qc1a0HFRAg==", "dev": true }, + "node_modules/@fortawesome/fontawesome-free": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.5.1.tgz", + "integrity": "sha512-CNy5vSwN3fsUStPRLX7fUYojyuzoEMSXPl7zSLJ8TgtRfjv24LOnOWKT2zYwaHZCJGkdyRnTmstR0P+Ah503Gw==", + "hasInstallScript": true, + "engines": { + "node": ">=6" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -3621,6 +3633,11 @@ "integrity": "sha512-Tbsj02wXCbqGmzdnXNk0SOF19ChhRU70BsroIi4Pm6Ehp56in6vch94mfbdQ17DozxkL3BAVjbZ4Qc1a0HFRAg==", "dev": true }, + "@fortawesome/fontawesome-free": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.5.1.tgz", + "integrity": "sha512-CNy5vSwN3fsUStPRLX7fUYojyuzoEMSXPl7zSLJ8TgtRfjv24LOnOWKT2zYwaHZCJGkdyRnTmstR0P+Ah503Gw==" + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", diff --git a/package.json b/package.json index 8931ad914..a6ab607f0 100644 --- a/package.json +++ b/package.json @@ -78,5 +78,8 @@ "from": "node_modules/quicklink/dist/quicklink.umd.js", "to": "assets/lib/quicklink/quicklink.umd.js" } - ] + ], + "dependencies": { + "@fortawesome/fontawesome-free": "^6.5.1" + } } diff --git a/scripts/update_icon.js b/scripts/update_icon.js index 2dbe43bec..ac10436d6 100644 --- a/scripts/update_icon.js +++ b/scripts/update_icon.js @@ -1,8 +1,8 @@ const jsdom = require("jsdom"); const fs = require("fs"); +const SVG_FILE_DIR = 'node_modules/@fortawesome/fontawesome-free/svgs/brands'; const DOC_DIR = "./exampleSite/content/samples/icons"; -const FONTAWESOME_VERSION = "v6.5.1"; const DEFAULT_TABLE_DELIMITER = "| -------------------- | --------------------------------- |"; /** @@ -12,8 +12,7 @@ const DEFAULT_TABLE_DELIMITER = "| -------------------- | ---------------------- */ const add_icon_to_congo = async (icon_name) => { try { - const icon_url = create_icon_url(icon_name, FONTAWESOME_VERSION); - const file = await get_file(icon_url); + const file = await get_file(icon_name); const final_svg = modify_svg_string(file); const icon_download_path = create_icon_download_path(icon_name); save_file(icon_download_path, final_svg); @@ -31,26 +30,16 @@ const modify_svg_string = (svg_string) => { svg.querySelector("path").setAttribute("fill", "currentColor"); return svg.outerHTML; } catch (e) { - throw new Error("Invalid SVG file"); + throw new Error("Invalid SVG file" + e); } }; -const create_icon_url = (icon_name, fontawesome_version) => { - return `https://site-assets.fontawesome.com/releases/${fontawesome_version}/svgs/brands/${icon_name}.svg`; -}; - const create_icon_download_path = (icon_name) => { return `./assets/icons/${icon_name}.svg`; }; const get_file = async (url) => { - console.log("Getting file at " + url + "..."); - const response = await fetch(url); - if (response.status >= 400) { - throw new Error("Could not download icon / icon not found"); - } - console.log("File retrieved!"); - return response.text(); + return fs.readFileSync(SVG_FILE_DIR + `/${url}.svg`, "utf8"); }; const save_file = (file_path, file) => { @@ -84,12 +73,16 @@ 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 !== ""); - table_rows.push(table_rows[0].replace("amazon", icon_name)); + table_rows.push(create_table_row(icon_name)); table_rows.sort(); const new_table = table_rows.join("\n"); return `${headers.trimEnd()}\n${DEFAULT_TABLE_DELIMITER}\n${new_table}\n`; }; +const create_table_row = (name) => { + return `| ${name} | {{< icon ${name} >}} |` +} + const get_md_docs = () => { return fs.readdirSync(DOC_DIR).filter((file) => file.endsWith(".md")); }; From 4d5643f8619281e78d930b49c81a08386471edf7 Mon Sep 17 00:00:00 2001 From: Francesco Maida Date: Sat, 16 Mar 2024 17:13:29 +0100 Subject: [PATCH 10/73] Added support for Umami Analytics. See #829 for further references. --- README.md | 2 +- exampleSite/config/_default/params.toml | 4 ++++ layouts/partials/analytics.html | 12 +++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4786ae4be..d1d772a65 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Congo is designed to be a powerful, lightweight theme for [Hugo](https://gohugo. - Heading anchors, Tables of Contents, Code copy, Buttons, Badges and more - HTML and Emoji support in articles 🎉 - SEO friendly with links for sharing to social media -- Fathom Analytics and Google Analytics support +- Fathom Analytics, Plausible Analytics, Umami Analytics and Google Analytics support - RSS feeds, Favicons and comments support - Advanced customisation using simple Tailwind colour definitions and styles - Optimised for performance and accessibility with perfect Lighthouse scores diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index ad33b74a0..0418c986c 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -71,6 +71,10 @@ fingerprintAlgorithm = "sha256" [fathomAnalytics] # site = "ABC12345" +#[umamiAnalytics] +# site = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +# region = "eu" # Can be either "eu" or "us" + [verification] # google = "" # bing = "" diff --git a/layouts/partials/analytics.html b/layouts/partials/analytics.html index a883f28d8..10c0ed16b 100644 --- a/layouts/partials/analytics.html +++ b/layouts/partials/analytics.html @@ -10,5 +10,15 @@ src="{{ default "https://plausible.io/js/script.js" site.Params.plausibleAnalytics.script }}" > {{ end }} + {{ with site.Params.umamiAnalytics }} + {{- $region := "eu" }} + {{- if isset . "region" }} + {{- $region = .region }} + {{- end }} + + {{ end }} {{ template "_internal/google_analytics.html" . }} -{{ end }} +{{ end }} \ No newline at end of file From c816c5fc3d0456594210669cc5012964ca86c8f9 Mon Sep 17 00:00:00 2001 From: Francesco Maida Date: Sat, 16 Mar 2024 17:28:00 +0100 Subject: [PATCH 11/73] Added support for Umami Analytics :sparkles: See #829 for further references. --- config/_default/params.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/_default/params.toml b/config/_default/params.toml index 82c4d16e8..f1d28a78b 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -75,6 +75,10 @@ fingerprintAlgorithm = "sha256" # event = "" # script = "" +#[umamiAnalytics] +# site = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +# region = "eu" # can be either "eu" or "us" + [verification] # google = "" # bing = "" From 78560462ca7abf89ad50f542f793dcab33acf42e Mon Sep 17 00:00:00 2001 From: Francesco Maida Date: Sun, 17 Mar 2024 21:00:55 +0100 Subject: [PATCH 12/73] Add Umami Analytics info to the documentation (in the english version) :memo: --- exampleSite/content/docs/configuration/index.md | 2 ++ exampleSite/content/docs/partials/index.md | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index d3c85e895..635f9d70c 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -175,6 +175,8 @@ Many of the article defaults here can be overridden on a per article basis by sp |`plausibleAnalytics.domain`|_Not set_|Enter the domain of the website you want to track. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.| |`plausibleAnalytics.event`|_Not set_|Plausible api event proxied URL. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.| |`plausibleAnalytics.script`|_Not set_|Plausible analysis script proxied URL. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.| +|`umamiAnalytics.site`|_Not set_|The tracking code generated by Umami Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.| +|`umamiAnalytics.region`|`eu`|Select the Umami Analytics server region to connect to. The value is a string that can be either `eu` or `us`.| |`verification.google`|_Not set_|The site verification string provided by Google to be included in the site metadata.| |`verification.bing`|_Not set_|The site verification string provided by Bing to be included in the site metadata.| |`verification.pinterest`|_Not set_|The site verification string provided by Pinterest to be included in the site metadata.| diff --git a/exampleSite/content/docs/partials/index.md b/exampleSite/content/docs/partials/index.md index 7f081f4aa..51a5c61f8 100644 --- a/exampleSite/content/docs/partials/index.md +++ b/exampleSite/content/docs/partials/index.md @@ -40,6 +40,18 @@ To enable Plausible analytics support, simply provide the domain of the website script = "https://plausible.yoursite.com/js/script.js" ``` +### 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. + +```toml +# config/_default/params.toml + +[umamiAnalytics] + site = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + region = "eu" # can be either "eu" or "us" +``` + ### Google Analytics Google Analytics support is provided through the internal Hugo partial. Simply provide the `googleAnalytics` key in the `config/_default/config.toml` file and the script will be added automatically. From 4f65d3bf4e866ad2c9f90712728fac08928a7709 Mon Sep 17 00:00:00 2001 From: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com> Date: Mon, 1 Apr 2024 19:43:01 +1300 Subject: [PATCH 13/73] :sparkles: add defaultThemeColor option --- config/_default/params.toml | 2 ++ exampleSite/content/docs/configuration/index.ja.md | 1 + exampleSite/content/docs/configuration/index.md | 1 + exampleSite/content/docs/configuration/index.zh-cn.md | 1 + layouts/partials/head.html | 2 +- 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index 82c4d16e8..e74d5dc70 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -9,6 +9,8 @@ colorScheme = "congo" defaultAppearance = "light" # valid options: light or dark autoSwitchAppearance = true +defaultThemeColor = "#FFFFFF" + enableSearch = false enableCodeCopy = false enableImageLazyLoading = true diff --git a/exampleSite/content/docs/configuration/index.ja.md b/exampleSite/content/docs/configuration/index.ja.md index 2cdc32688..39bb08534 100644 --- a/exampleSite/content/docs/configuration/index.ja.md +++ b/exampleSite/content/docs/configuration/index.ja.md @@ -127,6 +127,7 @@ Congoはテーマの機能を制御する多数の設定パラメーターを提 |Name|Default|Description| |---|---|---| |`colorScheme`|`"congo"`|使用する配色。有効な値は `congo` (デフォルト), `avocado`, `cherry`, `fire`, `ocean`, `sapphire`, `slate` です。詳しくは [カラースキーム]({{< ref "getting-started#カラースキーム" >}})セクションを参照してください。| +|`defaultThemeColor`|`"#FFFFFF"`|まだ翻訳されていません。| |`defaultAppearance`|`"light"`|デフォルトのテーマ外観、 `light` または `dark` のいずれか。| |`autoSwitchAppearance`|`true`|テーマの外観を訪問者のオペレーティングシステムの設定に基づいて自動的に切り替えるかどうか。常に `defaultAppearance` を使うようにするには `false` を設定します。| |`enableSearch`|`false`|サイト内検索を有効にするかどうか。検索機能を有効にするには `true` を設定します。検索機能は、[サイト設定](#サイト設定)の `outputs.home` が正しく設定されているかどうかに依存することに注意してください。| diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index 15eec9e8c..76bd7c717 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -127,6 +127,7 @@ Many of the article defaults here can be overridden on a per article basis by sp |Name|Default|Description| |---|---|---| |`colorScheme`|`"congo"`|The theme colour scheme to use. Valid values are `congo` (default), `avocado`, `cherry`, `fire`, `ocean`, `sapphire` and `slate`. Refer to the [Colour Schemes]({{< ref "getting-started#colour-schemes" >}}) section for more details.| +|`defaultThemeColor`|`"#FFFFFF"`|The original value (before any scripts modify it) to use for the `theme-color` meta tag. The meta tag will be changed based on the theme (`light` or `dark`) but it is useful for services that source the original value this tag to display an accent color (e.g. Discord)| |`defaultAppearance`|`"light"`|The default theme appearance, either `light` or `dark`.| |`autoSwitchAppearance`|`true`|Whether the theme appearance automatically switches based upon the visitor's operating system preference. Set to `false` to force the site to always use the `defaultAppearance`.| |`enableSearch`|`false`|Whether site search is enabled. Set to `true` to enable search functionality. Note that the search feature depends on the `outputs.home` setting in the [site configuration](#site-configuration) being set correctly.| diff --git a/exampleSite/content/docs/configuration/index.zh-cn.md b/exampleSite/content/docs/configuration/index.zh-cn.md index 76f8feb02..486d078dc 100644 --- a/exampleSite/content/docs/configuration/index.zh-cn.md +++ b/exampleSite/content/docs/configuration/index.zh-cn.md @@ -125,6 +125,7 @@ Congo 提供了大量的配置参数,用于控制主题的功能。下表概 |名称|默认值|描述| |---|---|---| |`colorScheme`|`"congo"`|要使用的主题颜色方案。有效值为 `congo`(默认)、`avocado`、`cherry`、`fire`、`ocean`、`sapphire` 和 `slate`。有关详细信息,请参阅[颜色方案]({{< ref "getting-started#颜色方案" >}})部分。| +|`defaultThemeColor`|`"#FFFFFF`|`theme-color` meta 标签的原值(在脚本修改它之前)。meta 标签会根据所选主题而变化(`light` 或 `dark`),但是一些软件(例如 Discord)会使用该标签的原值来显示主题色。| |`defaultAppearance`|`"light"`|默认的主题外观,可以是 `light` 或 `dark`。| |`autoSwitchAppearance`|`true`|主题外观是否根据访问者的操作系统首选项自动切换。设置为 `false` 以始终使用 `defaultAppearance`。| |`enableSearch`|`false`|是否启用站内搜索。设置为 `true` 以启用搜索功能。请注意,搜索功能取决于 [站点配置](#site-configuration) 中的 `outputs.home` 设置正确。| diff --git a/layouts/partials/head.html b/layouts/partials/head.html index b364b7854..efb9c8344 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,7 +1,7 @@ - + {{/* Title */}} {{ if .IsHome -}} {{ .Site.Title | emojify }} From 0fd089ea29fb18c0ed48852216574d39a25ff020 Mon Sep 17 00:00:00 2001 From: Matt Strayer Date: Tue, 2 Apr 2024 10:06:12 -0400 Subject: [PATCH 14/73] add `mattstrayer.com` --- exampleSite/content/users/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/exampleSite/content/users/index.md b/exampleSite/content/users/index.md index 4d4878f02..c40371af7 100644 --- a/exampleSite/content/users/index.md +++ b/exampleSite/content/users/index.md @@ -74,5 +74,6 @@ The list below is just a handful of the websites that are built using the Congo | [gorbe.io](https://www.gorbe.io) | Business Site and Blog | | [techwolf12.nl](https://techwolf12.nl) | Personal Site and Tech Blog | | [kylecapehart.com](https://kylecapehart.com/) | Personal Site and Blog | +| [mattstrayer.com](https://www.mattstrayer.com/) | Personal Site and Blog | **Congo user?** To add your site to this list, [submit a pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md). From 480d921cefb86580b3d33b96c71f7e4f25215e88 Mon Sep 17 00:00:00 2001 From: Christopher Louvet Date: Thu, 4 Apr 2024 09:45:12 +0700 Subject: [PATCH 15/73] Add Bluesky icon --- assets/icons/bluesky.svg | 1 + exampleSite/content/samples/icons/index.de.md | 1 + exampleSite/content/samples/icons/index.es.md | 1 + exampleSite/content/samples/icons/index.ja.md | 1 + exampleSite/content/samples/icons/index.md | 1 + exampleSite/content/samples/icons/index.zh-cn.md | 1 + 6 files changed, 6 insertions(+) create mode 100644 assets/icons/bluesky.svg diff --git a/assets/icons/bluesky.svg b/assets/icons/bluesky.svg new file mode 100644 index 000000000..07bbec0e1 --- /dev/null +++ b/assets/icons/bluesky.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/exampleSite/content/samples/icons/index.de.md b/exampleSite/content/samples/icons/index.de.md index 7f9daca5a..3242d7d12 100644 --- a/exampleSite/content/samples/icons/index.de.md +++ b/exampleSite/content/samples/icons/index.de.md @@ -21,6 +21,7 @@ Die vollständige Liste der integrierten Icons und ihre entsprechenden Namen fin | apple | {{< icon apple >}} | | bars | {{< icon bars >}} | | blogger | {{< icon blogger >}} | +| bluesky | {{< icon bluesky >}} | | bug | {{< icon bug >}} | | check | {{< icon check >}} | | chevron-down | {{< icon chevron-down >}} | diff --git a/exampleSite/content/samples/icons/index.es.md b/exampleSite/content/samples/icons/index.es.md index e015ffb2e..f4091f968 100644 --- a/exampleSite/content/samples/icons/index.es.md +++ b/exampleSite/content/samples/icons/index.es.md @@ -21,6 +21,7 @@ La lista completa de íconos incorporados y sus nombres correspondientes se pued | apple | {{< icon apple >}} | | bars | {{< icon bars >}} | | blogger | {{< icon blogger >}} | +| bluesky | {{< icon bluesky >}} | | bug | {{< icon bug >}} | | check | {{< icon check >}} | | chevron-down | {{< icon chevron-down >}} | diff --git a/exampleSite/content/samples/icons/index.ja.md b/exampleSite/content/samples/icons/index.ja.md index 375bde2e8..c986e32f3 100644 --- a/exampleSite/content/samples/icons/index.ja.md +++ b/exampleSite/content/samples/icons/index.ja.md @@ -21,6 +21,7 @@ Congo は[FontAwesome 6](https://fontawesome.com/icons)のアイコンをサポ | apple | {{< icon apple >}} | | bars | {{< icon bars >}} | | blogger | {{< icon blogger >}} | +| bluesky | {{< icon bluesky >}} | | bug | {{< icon bug >}} | | check | {{< icon check >}} | | chevron-down | {{< icon chevron-down >}} | diff --git a/exampleSite/content/samples/icons/index.md b/exampleSite/content/samples/icons/index.md index 7254d3e84..3aa319bba 100644 --- a/exampleSite/content/samples/icons/index.md +++ b/exampleSite/content/samples/icons/index.md @@ -21,6 +21,7 @@ The full list of built-in icons and their corresponding names can referenced bel | apple | {{< icon apple >}} | | bars | {{< icon bars >}} | | blogger | {{< icon blogger >}} | +| bluesky | {{< icon bluesky >}} | | bug | {{< icon bug >}} | | check | {{< icon check >}} | | chevron-down | {{< icon chevron-down >}} | diff --git a/exampleSite/content/samples/icons/index.zh-cn.md b/exampleSite/content/samples/icons/index.zh-cn.md index 20b9e846b..fe10190b8 100644 --- a/exampleSite/content/samples/icons/index.zh-cn.md +++ b/exampleSite/content/samples/icons/index.zh-cn.md @@ -21,6 +21,7 @@ Congo内置了对多个[FontAwesome 6](https://fontawesome.com/icons)图标的 | apple | {{< icon apple >}} | | bars | {{< icon bars >}} | | blogger | {{< icon blogger >}} | +| bluesky | {{< icon bluesky >}} | | bug | {{< icon bug >}} | | check | {{< icon check >}} | | chevron-down | {{< icon chevron-down >}} | From a6e1afcc800707fe5fa9eec8b07ed644abfc1da0 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:06:32 +1000 Subject: [PATCH 16/73] =?UTF-8?q?=F0=9F=93=9D=20Update=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0a83e822..667474ce1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Added + +- New icon for `bluesky` ([#851](https://github.com/jpanther/congo/pull/851)) + ## [2.8.2] - 2024-04-17 ### Added From 577d2bbe6e110c3ec996c88874065b57399d90dc Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:11:56 +1000 Subject: [PATCH 17/73] =?UTF-8?q?=F0=9F=93=9D=20Update=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 667474ce1..8d38ee32b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Added +- Umami Analytics support ([#832](https://github.com/jpanther/congo/pull/832)) +- Theme parameter to set a default HTML theme colour ([#849](https://github.com/jpanther/congo/pull/849)) - New icon for `bluesky` ([#851](https://github.com/jpanther/congo/pull/851)) ## [2.8.2] - 2024-04-17 From 6c1f3acb8d94ded92ec98e8691b882363739867b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 28 Apr 2024 23:55:26 +0000 Subject: [PATCH 18/73] =?UTF-8?q?=F0=9F=93=8C=20Bump=20@tailwindcss/typogr?= =?UTF-8?q?aphy=20from=200.5.12=20to=200.5.13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [@tailwindcss/typography](https://github.com/tailwindlabs/tailwindcss-typography) from 0.5.12 to 0.5.13. - [Release notes](https://github.com/tailwindlabs/tailwindcss-typography/releases) - [Changelog](https://github.com/tailwindlabs/tailwindcss-typography/blob/master/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/tailwindcss-typography/compare/v0.5.12...v0.5.13) --- updated-dependencies: - dependency-name: "@tailwindcss/typography" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 18 +++++++++--------- package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index db47efe60..0eb90a916 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,16 @@ { "name": "hugo-congo-theme", - "version": "2.8.1", + "version": "2.8.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "hugo-congo-theme", - "version": "2.8.1", + "version": "2.8.2", "hasInstallScript": true, "license": "MIT", "devDependencies": { - "@tailwindcss/typography": "^0.5.12", + "@tailwindcss/typography": "^0.5.13", "chart.js": "^4.4.2", "fuse.js": "^7.0.0", "katex": "^0.16.10", @@ -168,9 +168,9 @@ } }, "node_modules/@tailwindcss/typography": { - "version": "0.5.12", - "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.12.tgz", - "integrity": "sha512-CNwpBpconcP7ppxmuq3qvaCxiRWnbhANpY/ruH4L5qs2GCiVDJXde/pjj2HWPV1+Q4G9+V/etrwUYopdcjAlyg==", + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.13.tgz", + "integrity": "sha512-ADGcJ8dX21dVVHIwTRgzrcunY6YY9uSlAHHGVKvkA+vLc5qLwEszvKts40lx7z0qc4clpjclwLeK5rVCV2P/uw==", "dev": true, "dependencies": { "lodash.castarray": "^4.4.0", @@ -3292,9 +3292,9 @@ "optional": true }, "@tailwindcss/typography": { - "version": "0.5.12", - "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.12.tgz", - "integrity": "sha512-CNwpBpconcP7ppxmuq3qvaCxiRWnbhANpY/ruH4L5qs2GCiVDJXde/pjj2HWPV1+Q4G9+V/etrwUYopdcjAlyg==", + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.13.tgz", + "integrity": "sha512-ADGcJ8dX21dVVHIwTRgzrcunY6YY9uSlAHHGVKvkA+vLc5qLwEszvKts40lx7z0qc4clpjclwLeK5rVCV2P/uw==", "dev": true, "requires": { "lodash.castarray": "^4.4.0", diff --git a/package.json b/package.json index d8f238d52..ea4ffdc6b 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/jpanther/congo#readme", "devDependencies": { - "@tailwindcss/typography": "^0.5.12", + "@tailwindcss/typography": "^0.5.13", "chart.js": "^4.4.2", "fuse.js": "^7.0.0", "katex": "^0.16.10", From c77997d8c8fc7821188ca10935f890be6b63f918 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Sun, 28 Apr 2024 23:55:45 +0000 Subject: [PATCH 19/73] =?UTF-8?q?=F0=9F=92=84=20Rebuild=20CSS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/compiled/main.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index c5fd308e6..3d208df6c 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -983,19 +983,19 @@ video { margin-bottom: 0.75em; } -.prose :where(.prose > ul > li > *:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { +.prose :where(.prose > ul > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { margin-top: 1.25em; } -.prose :where(.prose > ul > li > *:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { +.prose :where(.prose > ul > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { margin-bottom: 1.25em; } -.prose :where(.prose > ol > li > *:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { +.prose :where(.prose > ol > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { margin-top: 1.25em; } -.prose :where(.prose > ol > li > *:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { +.prose :where(.prose > ol > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { margin-bottom: 1.25em; } From 41acfd2ac6a530d49441ae134298329b67ef836d Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Mon, 29 Apr 2024 15:33:50 +1000 Subject: [PATCH 20/73] =?UTF-8?q?=F0=9F=93=9D=20Update=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d38ee32b..b43c4f811 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Theme parameter to set a default HTML theme colour ([#849](https://github.com/jpanther/congo/pull/849)) - New icon for `bluesky` ([#851](https://github.com/jpanther/congo/pull/851)) +### Changed + +- Upgrade to Typography v0.5.13 ([#864](https://github.com/jpanther/congo/pull/864)) + ## [2.8.2] - 2024-04-17 ### Added From 9daf083f4642390d2551070e513c9e54eea7feea Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Mon, 29 Apr 2024 15:36:19 +1000 Subject: [PATCH 21/73] =?UTF-8?q?=F0=9F=90=9B=20Fix=20featured=20images=20?= =?UTF-8?q?overlap=20page=20title=20when=20metadata=20hidden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: #827 --- CHANGELOG.md | 4 ++++ assets/css/compiled/main.css | 12 ++++++++---- exampleSite/config/_default/params.toml | 2 +- layouts/_default/single.html | 8 ++++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b43c4f811..a99b911a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Upgrade to Typography v0.5.13 ([#864](https://github.com/jpanther/congo/pull/864)) +### Fixed + +- Featured images overlap page title when article metadata hidden ([#827](https://github.com/jpanther/congo/issues/827)) + ## [2.8.2] - 2024-04-17 ### Added diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 3d208df6c..f2d08242b 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -1903,14 +1903,14 @@ code { margin-top: -0.75rem; } -.-mt-4 { - margin-top: -1rem; -} - .mb-1 { margin-bottom: 0.25rem; } +.mb-10 { + margin-bottom: 2.5rem; +} + .mb-12 { margin-bottom: 3rem; } @@ -1927,6 +1927,10 @@ code { margin-bottom: 1.5rem; } +.mb-8 { + margin-bottom: 2rem; +} + .mb-\[2px\] { margin-bottom: 2px; } diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 0418c986c..0489c5d0f 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -72,7 +72,7 @@ fingerprintAlgorithm = "sha256" # site = "ABC12345" #[umamiAnalytics] -# site = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +# site = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # region = "eu" # Can be either "eu" or "us" [verification] diff --git a/layouts/_default/single.html b/layouts/_default/single.html index da9ee2384..2f2668ccd 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -7,7 +7,7 @@ {{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }} {{ partial "breadcrumbs.html" . }} {{ end }} -

+

{{ .Title | emojify }}

{{ if or @@ -17,14 +17,14 @@

(and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0)) (.Params.showEdit | default (.Site.Params.article.showEdit | default false)) }} -
+
{{ partial "article-meta.html" (dict "context" . "scope" "single") }}
{{ end }} {{ with $feature }}
{{ $altText := $.Params.featureAlt | default $.Params.coverAlt | default "" }} - {{ $class := "mb-6 -mt-4 rounded-md" }} + {{ $class := "mb-6 rounded-md" }} {{ $webp := $.Page.Site.Params.enableImageWebp | default true }} {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "lazy" false "webp" $webp) }} {{ with $.Params.coverCaption }} @@ -36,7 +36,7 @@

{{ if and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in .TableOfContents " -
+
{{ partial "toc.html" . }}
From 2468e3b21eec52ef9ee3160fcaf47a54400c6b8d Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:00:00 +1000 Subject: [PATCH 22/73] =?UTF-8?q?=F0=9F=91=B7=20Update=20actions/stale=20c?= =?UTF-8?q?onfig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/stale.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 49d875319..dd62e3396 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -15,9 +15,9 @@ jobs: days-before-stale: 120 days-before-close: 30 stale-issue-label: "stale" - exempt-issue-labels: "wip" + exempt-issue-labels: "wip,help wanted,dependencies" stale-pr-label: "stale" - exempt-pr-labels: "wip" + exempt-pr-labels: "wip,help wanted,dependencies" stale-issue-message: > This issue has been automatically marked as stale because it has not had any recent activity. From c20e2338a891a2d8dc4cd989c75398078efc4368 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:38:36 +1000 Subject: [PATCH 23/73] =?UTF-8?q?=F0=9F=90=9B=20Fix=20inconsistent=20pictu?= =?UTF-8?q?re=20rendering=20when=20using=20Markdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: #828 --- CHANGELOG.md | 1 + layouts/shortcodes/figure.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a99b911a4..2092154dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Fixed - Featured images overlap page title when article metadata hidden ([#827](https://github.com/jpanther/congo/issues/827)) +- Inconsistent picture rendering between `figure` shortcode and Markdown render hook ([#828](https://github.com/jpanther/congo/issues/828)) ## [2.8.2] - 2024-04-17 diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 25eca5819..7f0e2eec7 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -5,7 +5,7 @@ {{ $altText := .Get "alt" }} {{ $caption := .Get "caption" }} {{ $href := .Get "href" }} - {{ $class := .Get "class" }} + {{ $class := default "mx-auto my-0 rounded-md" (.Get "class") }} {{ $file := $url.Path }} {{ $img := .Page.Resources.GetMatch $file }} From f5d856fa2fe3d2bc227d93528235c2056fd2387b Mon Sep 17 00:00:00 2001 From: Noam Lerner Date: Tue, 16 Apr 2024 08:31:27 +0300 Subject: [PATCH 24/73] :memo: Add noamlerner.com to users --- exampleSite/content/users/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/exampleSite/content/users/index.md b/exampleSite/content/users/index.md index 1ca8a2298..65b3764e1 100644 --- a/exampleSite/content/users/index.md +++ b/exampleSite/content/users/index.md @@ -76,5 +76,6 @@ The list below is just a handful of the websites that are built using the Congo | [kylecapehart.com](https://kylecapehart.com/) | Personal Site and Blog | | [hosni.info](https://hosni.info/) | Personal site and Tech Blog | | [mattstrayer.com](https://www.mattstrayer.com/) | Personal Site and Blog | +| [noamlerner.com](https://www.noamlerner.com/) | Personal blog (English/Hebrew) | **Congo user?** To add your site to this list, [submit a pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md). From 62a8c979b1cefc689aeca9b740627c56d6b2b10a Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:18:38 +1000 Subject: [PATCH 25/73] =?UTF-8?q?=F0=9F=8E=A8=20Code=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/docs/configuration/index.zh-cn.md | 55 ++++++++++--------- .../content/docs/front-matter/index.zh-cn.md | 2 +- .../docs/homepage-layout/index.zh-cn.md | 2 +- .../content/docs/installation/index.zh-cn.md | 2 +- exampleSite/content/docs/partials/index.md | 4 +- .../content/samples/emoji/index.zh-cn.md | 2 +- .../content/samples/markdown/index.zh-cn.md | 14 ++--- .../mathematical-notation/index.zh-cn.md | 2 +- layouts/_default/baseof.html | 2 +- layouts/partials/analytics.html | 11 ++-- layouts/partials/breadcrumbs.html | 2 +- layouts/partials/header/basic.html | 2 +- layouts/partials/header/hamburger.html | 2 +- layouts/partials/header/hybrid.html | 2 +- layouts/partials/search.html | 2 +- scripts/update_icon.js | 11 ++-- 16 files changed, 61 insertions(+), 56 deletions(-) diff --git a/exampleSite/content/docs/configuration/index.zh-cn.md b/exampleSite/content/docs/configuration/index.zh-cn.md index 486d078dc..654212c22 100644 --- a/exampleSite/content/docs/configuration/index.zh-cn.md +++ b/exampleSite/content/docs/configuration/index.zh-cn.md @@ -48,33 +48,33 @@ Congo 针对完整的多语言网站进行了优化,并且主题assets中已 该主题目前支持以下语言: -| 语言 | 代码 | -| --------------------------------------- | ------- | -| :gb: **英语(默认)** | `en` | -| :egypt: 阿拉伯语 | `ar` | -| :bangladesh: 孟加拉语 | `bn` | -| :bulgaria: 保加利亚语 | `bg` | -| :cn: 中文 - 简体(中国) | `zh-cn` | -| :taiwan: 中文 - 繁体(台湾) | `zh-tw` | -| :flag-cz: 捷克语 | `cs` | -| :netherlands: 荷兰语 | `nl` | -| :finland: 芬兰语 | `fi` | -| :fr: 法语 | `fr` | -| :de: 德语 | `de` | -| :israel: 希伯来语 | `he` | -| :hungary: 匈牙利语 | `hu` | -| :indonesia: 印尼语 | `id` | -| :it: 意大利语 | `it` | -| :jp: 日语 | `ja` | -| :poland: 波兰语 | `pl` | -| :brazil: 葡萄牙语(巴西) | `pt-br` | -| :portugal: 葡萄牙语(葡萄牙) | `pt-pt` | -| :romania: 罗马尼亚语 | `ro` | -| :ru: 俄语 | `ru` | -| :slovakia: 斯洛伐克语 | `sk` | -| :es: 西班牙语(西班牙) | `es` | -| :tr: 土耳其语 | `tr` | -| :ukraine: 乌克兰语 | `uk` | +| 语言 | 代码 | +| ----------------------------- | ------- | +| :gb: **英语(默认)** | `en` | +| :egypt: 阿拉伯语 | `ar` | +| :bangladesh: 孟加拉语 | `bn` | +| :bulgaria: 保加利亚语 | `bg` | +| :cn: 中文 - 简体(中国) | `zh-cn` | +| :taiwan: 中文 - 繁体(台湾) | `zh-tw` | +| :flag-cz: 捷克语 | `cs` | +| :netherlands: 荷兰语 | `nl` | +| :finland: 芬兰语 | `fi` | +| :fr: 法语 | `fr` | +| :de: 德语 | `de` | +| :israel: 希伯来语 | `he` | +| :hungary: 匈牙利语 | `hu` | +| :indonesia: 印尼语 | `id` | +| :it: 意大利语 | `it` | +| :jp: 日语 | `ja` | +| :poland: 波兰语 | `pl` | +| :brazil: 葡萄牙语(巴西) | `pt-br` | +| :portugal: 葡萄牙语(葡萄牙) | `pt-pt` | +| :romania: 罗马尼亚语 | `ro` | +| :ru: 俄语 | `ru` | +| :slovakia: 斯洛伐克语 | `sk` | +| :es: 西班牙语(西班牙) | `es` | +| :tr: 土耳其语 | `tr` | +| :ukraine: 乌克兰语 | `uk` | 默认翻译可以通过在 `i18n/[code].yaml` 中创建自定义文件来覆盖,其中包含翻译字符串。您还可以使用此方法添加新语言。如果您希望与社区分享新的翻译,请[Pull Request](https://github.com/jpanther/congo/pulls)。 @@ -178,6 +178,7 @@ Congo 提供了大量的配置参数,用于控制主题的功能。下表概 |`verification.bing`|_未设置_|由 Bing 提供的要包含在站点元数据中的站点验证字符串。| |`verification.pinterest`|_未设置_|由 Pinterest 提供的要包含在站点元数据中的站点验证字符串。| |`verification.yandex`|_未设置_|由 Yandex 提供的要包含在站点元数据中的站点验证字符串。| + ## 其他配置文件 diff --git a/exampleSite/content/docs/front-matter/index.zh-cn.md b/exampleSite/content/docs/front-matter/index.zh-cn.md index 8a90cb322..512b8befd 100644 --- a/exampleSite/content/docs/front-matter/index.zh-cn.md +++ b/exampleSite/content/docs/front-matter/index.zh-cn.md @@ -48,4 +48,4 @@ Front Matter参数的默认值是从主题的[基础配置]({{< ref "configurati |`showSummary`|`list.showSummary`|是否在列表页上显示文章摘要。| |`summary`|使用 `summaryLength` 自动生成(参见[站点配置]({{< ref "configuration#site-configuration" >}}))|当启用 `showSummary` 时,用作此文章摘要的 Markdown 字符串。| |`xml`|`true`,除非被 `sitemap.excludedKinds` 排除|此文章是否包含在生成的 `/sitemap.xml` 文件中。| - \ No newline at end of file + diff --git a/exampleSite/content/docs/homepage-layout/index.zh-cn.md b/exampleSite/content/docs/homepage-layout/index.zh-cn.md index b1171e996..4411678e8 100644 --- a/exampleSite/content/docs/homepage-layout/index.zh-cn.md +++ b/exampleSite/content/docs/homepage-layout/index.zh-cn.md @@ -50,4 +50,4 @@ profile布局非常适用于个人网站和博客。它通过提供图像和社 ![具有最近文章的个人资料布局](home-profile-list.jpg) -此部分中列出的文章来自 `mainSections` 设置,该设置允许使用您网站上使用的所有内容类型。例如,如果您有用于 _posts_ 和 _projects_ 的内容部分,可以将此设置设置为 `["posts", "projects"]`,所有这两个部分中的文章都将用于填充最近的列表。主题期望此设置为数组,因此如果您只使用一个部分来存储所有内容,您应相应地设置为 `["blog"]`。 \ No newline at end of file +此部分中列出的文章来自 `mainSections` 设置,该设置允许使用您网站上使用的所有内容类型。例如,如果您有用于 _posts_ 和 _projects_ 的内容部分,可以将此设置设置为 `["posts", "projects"]`,所有这两个部分中的文章都将用于填充最近的列表。主题期望此设置为数组,因此如果您只使用一个部分来存储所有内容,您应相应地设置为 `["blog"]`。 diff --git a/exampleSite/content/docs/installation/index.zh-cn.md b/exampleSite/content/docs/installation/index.zh-cn.md index 36b7af604..e6c6a3dd5 100644 --- a/exampleSite/content/docs/installation/index.zh-cn.md +++ b/exampleSite/content/docs/installation/index.zh-cn.md @@ -170,4 +170,4 @@ git submodule update --remote --merge 2. 解压缩存档,将文件夹重命名为 `congo`,并将其移动到Hugo项目根文件夹内的 `themes/` 目录。您需要覆盖现有目录以替换所有主题文件。 -3. 重新构建您的站点 \ No newline at end of file +3. 重新构建您的站点 diff --git a/exampleSite/content/docs/partials/index.md b/exampleSite/content/docs/partials/index.md index 51a5c61f8..23d884703 100644 --- a/exampleSite/content/docs/partials/index.md +++ b/exampleSite/content/docs/partials/index.md @@ -42,13 +42,13 @@ 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 [umamiAnalytics] - site = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + site = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" region = "eu" # can be either "eu" or "us" ``` diff --git a/exampleSite/content/samples/emoji/index.zh-cn.md b/exampleSite/content/samples/emoji/index.zh-cn.md index 5e2f2c551..cb2a9818a 100644 --- a/exampleSite/content/samples/emoji/index.zh-cn.md +++ b/exampleSite/content/samples/emoji/index.zh-cn.md @@ -16,4 +16,4 @@ Congo 自动在整个主题中替换 Emoji,因此您可以在内容和前置 **示例:** `see_no_evil` :see_no_evil:, `hear_no_evil` :hear_no_evil:, `speak_no_evil` :speak_no_evil:。 -[Emojipedia](https://emojipedia.org/) 是一个有用的 Emoji 简码参考网站。 \ No newline at end of file +[Emojipedia](https://emojipedia.org/) 是一个有用的 Emoji 简码参考网站。 diff --git a/exampleSite/content/samples/markdown/index.zh-cn.md b/exampleSite/content/samples/markdown/index.zh-cn.md index 52cd017d0..7693b3850 100644 --- a/exampleSite/content/samples/markdown/index.zh-cn.md +++ b/exampleSite/content/samples/markdown/index.zh-cn.md @@ -56,22 +56,22 @@ tags: ["markdown", "css", "html", "sample"] 表格不属于核心Markdown规范,但Hugo原生支持它们,无需额外配置。 | 名前 | 年齢 | -| ----- | --- | -| Bob | 27 | -| Alice | 23 | +| ----- | ---- | +| Bob | 27 | +| Alice | 23 | ### 表格内的行内Markdown -| 斜体 | 粗体 | 代码 | -| --------- | -------- | ------ | -| _斜体_ | **粗体** | `代码` | +| 斜体 | 粗体 | 代码 | +| ------ | -------- | ------ | +| _斜体_ | **粗体** | `代码` | ## 代码块 ### 使用反引号的代码块 ```html - + diff --git a/exampleSite/content/samples/mathematical-notation/index.zh-cn.md b/exampleSite/content/samples/mathematical-notation/index.zh-cn.md index f0c88513c..9dc3a1d42 100644 --- a/exampleSite/content/samples/mathematical-notation/index.zh-cn.md +++ b/exampleSite/content/samples/mathematical-notation/index.zh-cn.md @@ -43,4 +43,4 @@ $$ $$ \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } -$$ \ No newline at end of file +$$ diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 4f492147e..defe45fcf 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -10,7 +10,7 @@ > {{- partial "head.html" . -}}
- + {{ end }} {{ template "_internal/google_analytics.html" . }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html index d466567f3..8003504d3 100644 --- a/layouts/partials/breadcrumbs.html +++ b/layouts/partials/breadcrumbs.html @@ -1,4 +1,4 @@ -
    +
      {{ template "crumb" (dict "p1" . "p2" .) }}
    {{ define "crumb" }} diff --git a/layouts/partials/header/basic.html b/layouts/partials/header/basic.html index 667bf7cb4..340826e74 100644 --- a/layouts/partials/header/basic.html +++ b/layouts/partials/header/basic.html @@ -1,4 +1,4 @@ -
    +