diff --git a/.gitattributes b/.gitattributes index d96586674..da3504671 100644 --- a/.gitattributes +++ b/.gitattributes @@ -198,7 +198,7 @@ TODO text *.tmpl text *.tpl text *.twig text -*.vue text +*.vue text diff=vue # Configs *.cnf text diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 05d579345..cc38e3fd4 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -100,7 +100,7 @@ #### Manually 1. Fork the repository by clicking the "Fork" button in the top right corner. -2. Make sure you have [Node.js](https://nodejs.org/en/), [pnpm](https://pnpm.io/), [git](https://git-scm.com/), and [VSCode](https://code.visualstudio.com/) or any other editor installed. +2. Make sure you have [Node.js](https://nodejs.org/en/), [pnpm](https://pnpm.io/), [git](https://git-scm.com/), and [VSCode](https://code.visualstudio.com/) or any other editor installed. Alternatively, `pnpm` has `pnpm env` you can use to manage Node. 3. Clone your forked repository to your local machine. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 8b1378917..000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/.github/POST_TEMPLATE.md b/.github/POST_TEMPLATE.md index 0f0715542..ca7f30eff 100644 --- a/.github/POST_TEMPLATE.md +++ b/.github/POST_TEMPLATE.md @@ -20,7 +20,6 @@ ### Post Template description: Month 20YY updates date: 20YY-MM-DD next: false -aside: left prev: false sidebar: false footer: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 0d4cf89d4..000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,23 +0,0 @@ - - -## Description - - -## Context - - - -## Types of changes - -- [ ] Bad / Deleted sites removal -- [ ] Grammar / Markdown fixes -- [ ] Content addition (sites, projects, tools, etc.) -- [ ] New Wiki section -- [ ] Section Improvement - -## Checklist: - - -- [ ] I have read the [contribution guide](https://fmhy.net/other/contributing). -- [ ] I have made sure to [search](https://api.fmhy.net/single-page) before making any changes. -- [ ] My code follows the code style of this project. diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 17050009d..000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,9 +0,0 @@ -# See https://github.com/actions/labeler - -docs: - - 'docs/**/*.md' - -core: - - 'api/**' - - '.github/**' - - 'docs/.vitepress/**' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index a8fae961a..000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: 'Pull Request Housekeeping' - -on: [pull_request_target] - -jobs: - triage: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Label PRs - uses: actions/labeler@v4 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/.vitepress/markdown/headers.ts b/docs/.vitepress/markdown/headers.ts index af2984d08..5c36edb04 100644 --- a/docs/.vitepress/markdown/headers.ts +++ b/docs/.vitepress/markdown/headers.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) taskylizard. All rights reserved. + * Copyright (c) 2024 taskylizard * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,20 +13,53 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import type { MarkdownRenderer } from 'vitepress' -import { headers } from '../transformer/constants' -const titles = Object.keys(headers).map((key) => headers[key].title) +const excluded = ['Credits'] export const headersPlugin = (md: MarkdownRenderer) => { - // Add the Feedback component after the heading and close the container - md.renderer.rules.heading_close = (tokens, idx, options, env, self) => { - const result = self.renderToken(tokens, idx, options) - const heading = tokens[idx - 1] - const level = tokens[idx].tag.slice(1) - if (!titles.includes(env.frontmatter.title) || level !== '2') return result + // Add the Feedback component in the heading, before the link. + // + // Adding it after the link is closed prevents vitepress from properly + // indexing the file's content. - return `${result}` + md.renderer.rules.heading_open = (tokens, idx, options, env, self) => { + const result = self.renderToken(tokens, idx, options) + + const idxClose = + idx + + tokens.slice(idx).findIndex((token) => token.type === 'heading_close') + if (idxClose <= idx) return result + + const level = tokens[idx].tag.slice(1) + if (excluded.includes(env.frontmatter.title) || level !== '2') return result + + // Find the token for the link. + // + // The token after `heading_open` contains the link as a child token. + const children = tokens[idx + 1].children || [] + const linkOpenToken = children.find((c) => c.type === 'link_open') + if (!linkOpenToken) return result + + const heading = tokens[idxClose - 1] + + linkOpenToken.meta = linkOpenToken.meta || {} + linkOpenToken.meta.feedback = { + heading: heading.content + } + + return result + } + + md.renderer.rules.link_open = (tokens, idx, options, env, self) => { + const result = self.renderToken(tokens, idx, options) + + const meta = tokens[idx].meta + if (!meta || !meta.feedback) return result + + const heading = meta.feedback.heading || '' + if (!heading) return result + + return `${result}` } } diff --git a/package.json b/package.json index 7b17345ee..75843396c 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "docs:dev": "vitepress dev docs/", "docs:preview": "vitepress preview docs/", "format": "prettier -w --cache --check .", - "postinstall": "nitropack prepare", "lint": "biome lint .", "lint:fix": "biome lint . --write", "lint:fix:unsafe": "biome lint . --write --unsafe", @@ -33,15 +32,15 @@ "nitro-cors": "^0.7.1", "nitropack": "^2.10.4", "nprogress": "^0.2.0", - "pathe": "^1.1.2", - "unocss": "^0.63.4", + "pathe": "^2.0.1", + "unocss": "65.4.0", "vitepress": "^1.5.0", "vue": "^3.5.12", "x-satori": "^0.2.0", "zod": "^3.23.8" }, "devDependencies": { - "@biomejs/biome": "^1.9.3", + "@biomejs/biome": "^1.9.4", "@cloudflare/workers-types": "^4.20241230.0", "@ianvs/prettier-plugin-sort-imports": "^4.3.1", "@iconify-json/carbon": "^1.2.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 55a8e9c41..e4705190b 100644 Binary files a/pnpm-lock.yaml and b/pnpm-lock.yaml differ