n/blogu/Clina · 6 个月前
注册 登录
n/blog · 6 个月前 · 111 次浏览
u/Clina钻石

对Fuwari进行亿些改动

1. 增加评论

参考这篇文章

2. 增加友链

参考这篇文章

3. 增加访问统计卡片

参考这篇文章

4. 图片标题

参考这个 PR

5. 音乐播放器

参考这篇文章

6. Codeberg 仓库卡片

在 src/plugins 新建 rehype-component-codeberg-card.mjs 文件,并写入以下内容:

/// <reference types="mdast" />
import { h } from "hastscript";

/**
 * Creates a Codeberg Card component.
 *
 * @param {Object} properties - The properties of the component.
 * @param {string} properties.repo - The Codeberg repository in the format "owner/repo".
 * @param {import('mdast').RootContent[]} children - The children elements of the component.
 * @returns {import('mdast').Parent} The created Codeberg Card component.
 */
export function CodebergCardComponent(properties, children) {
 if (Array.isArray(children) && children.length !== 0)
  return h("div", { class: "hidden" }, [
   'Invalid directive. ("codeberg" directive must be leaf type "::codeberg{repo="owner/repo"}")',
  ]);

 if (!properties.repo || !properties.repo.includes("/"))
  return h(
   "div",
   { class: "hidden" },
   'Invalid repository. ("repo" attributte must be in the format "owner/repo")',
  );

 const repo = properties.repo;
 const cardUuid = `GC${Math.random().toString(36).slice(-6)}`; // Collisions are not important

 const nAvatar = h(`div#${cardUuid}-avatar`, { class: "gc-avatar" });
 const nLanguage = h(
  `span#${cardUuid}-language`,
  { class: "gc-language" },
  "Waiting...",
 );

 const nTitle = h("div", { class: "gc-titlebar" }, [
  h("div", { class: "gc-titlebar-left" }, [
   h("div", { class: "gc-owner" }, [
    nAvatar,
    h("div", { class: "gc-user" }, repo.split("/")[0]),
   ]),
   h("div", { class: "gc-divider" }, "/"),
   h("div", { class: "gc-repo" }, repo.split("/")[1]),
  ]),
  h("div", { class: "codeberg-logo" }),
 ]);

 const nDescription = h(
  `div#${cardUuid}-description`,
  { class: "gc-description" },
  "Waiting for codeberg.org/api/v1...",
 );

 const nStars = h(`div#${cardUuid}-stars`, { class: "gc-stars" }, "00K");
 const nForks = h(`div#${cardUuid}-forks`, { class: "gc-forks" }, "0K");
 const nLicense = h(`div#${cardUuid}-license`, { class: "gc-license" }, "0K");

 const nScript = h(
  `script#${cardUuid}-script`,
  { type: "text/javascript", defer: true },
  `
      fetch('https://codeberg.org/api/v1/repos/${repo}', { referrerPolicy: "no-referrer" }).then(response => response.json()).then(data => {
        document.getElementById('${cardUuid}-description').innerText = data.description?.replace(/:[a-zA-Z0-9_]+:/g, '') || "Description not set";
        document.getElementById('${cardUuid}-language').innerText = data.language;
        document.getElementById('${cardUuid}-forks').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.forks_count).replaceAll("\u202f", '');
        document.getElementById('${cardUuid}-stars').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.stars_count).replaceAll("\u202f", '');
        const avatarEl = document.getElementById('${cardUuid}-avatar');
        avatarEl.style.backgroundImage = 'url(' + data.owner.avatar_url + ')';
        avatarEl.style.backgroundColor = 'transparent';
        // Codeberg API does not provide license information, hiding the license field
        document.getElementById('${cardUuid}-license').style.display = 'none';
        document.getElementById('${cardUuid}-card').classList.remove("fetch-waiting");
        console.log("[CODEBERG-CARD] Loaded card for ${repo} | ${cardUuid}.")
      }).catch(err => {
        const c = document.getElementById('${cardUuid}-card');
        c?.classList.add("fetch-error");
        console.warn("[CODEBERG-CARD] (Error) Loading card for ${repo} | ${cardUuid}.")
      })
    `,
 );

 return h(
  `a#${cardUuid}-card`,
  {
   class: "card-codeberg fetch-waiting no-styling",
   href: `https://codeberg.org/${repo}`,
   target: "_blank",
   repo,
  },
  [
   nTitle,
   nDescription,
   h("div", { class: "gc-infobar" }, [nStars, nForks, nLicense, nLanguage]),
   nScript,
  ],
 );
}

然后,在 astro.config.mjs 中添加以下内容:

import sitemap from "@astrojs/sitemap";
import svelte from "@astrojs/svelte";
import tailwind from "@astrojs/tailwind";
import mdx from '@astrojs/mdx';
import { pluginCollapsibleSections } from "@expressive-code/plugin-collapsible-sections";
import { pluginLineNumbers } from "@expressive-code/plugin-line-numbers";
import swup from "@swup/astro";
import expressiveCode from "astro-expressive-code";
import icon from "astro-icon";
import { defineConfig } from "astro/config";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeComponents from "rehype-components"; /* Render the custom directive content */
import rehypeKatex from "rehype-katex";
import rehypeSlug from "rehype-slug";
import remarkDirective from "remark-directive"; /* Handle directives */
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
import remarkMath from "remark-math";
import remarkSectionize from "remark-sectionize";
import { expressiveCodeConfig } from "./src/config.ts";
import { pluginLanguageBadge } from "./src/plugins/expressive-code/language-badge.ts";
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs";
+import { CodebergCardComponent } from "./src/plugins/rehype-component-codeberg-card.mjs";
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs";
import { parseDirectiveNode } from "./src/plugins/remark-directive-rehype.js";
import { remarkExcerpt } from "./src/plugins/remark-excerpt.js";
import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs";
import { pluginCustomCopyButton } from "./src/plugins/expressive-code/custom-copy-button.js";

// https://astro.build/config
export default defineConfig({
 site: "https://cli.loc.cc",
 base: "/",
 trailingSlash: "always",
 image: {
  // 全局响应式布局
  layout: "constrained",
 },
 experimental: {
  // Rust 编译器以提升构建性能(实验性)
  // 队列渲染以优化性能(实验性)
  queuedRendering: { enabled: true }, 
 },
 integrations: [
  tailwind({
   nesting: true,
  }),
  swup({
   theme: false,
   animationClass: "transition-swup-", // see https://swup.js.org/options/#animationselector
   // the default value `transition-` cause transition delay
   // when the Tailwind class `transition-all` is used
   containers: ["main", "#toc"],
   smoothScrolling: true,
   cache: true,
   preload: true,
   accessibility: true,
   updateHead: true,
   updateBodyClass: false,
   globalInstance: true,
  }),
  icon({
   include: {
    "preprocess: vitePreprocess(),": ["*"],
    "fa6-brands": ["*"],
    "fa6-regular": ["*"],
    "fa6-solid": ["*"],
   },
  }),
  expressiveCode({
   themes: [expressiveCodeConfig.darkTheme, expressiveCodeConfig.lightTheme],
   useDarkModeMediaQuery: false,
   plugins: [
    pluginCollapsibleSections(),
    pluginLineNumbers(),
    pluginLanguageBadge(),
    pluginCustomCopyButton()
   ],
   defaultProps: {
    wrap: true,
    overridesByLang: {
     shellsession: {
      showLineNumbers: false,
     },
    },
   },
   styleOverrides: {
    codeBackground: "var(--codeblock-bg)",
    borderRadius: "0.75rem",
    borderColor: "none",
    codeFontSize: "0.875rem",
    codeFontFamily: "'JetBrains Mono Variable', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
    codeLineHeight: "1.5rem",
    frames: {
     editorBackground: "var(--codeblock-bg)",
     terminalBackground: "var(--codeblock-bg)",
     terminalTitlebarBackground: "var(--codeblock-topbar-bg)",
     editorTabBarBackground: "var(--codeblock-topbar-bg)",
     editorActiveTabBackground: "none",
     editorActiveTabIndicatorBottomColor: "var(--primary)",
     editorActiveTabIndicatorTopColor: "none",
     editorTabBarBorderBottomColor: "var(--codeblock-topbar-bg)",
     terminalTitlebarBorderBottomColor: "none"
    },
    textMarkers: {
     delHue: 0,
     insHue: 180,
     markHue: 250
    }
   },
   frames: {
    showCopyToClipboardButton: false,
   }
  }),
        svelte(),
  sitemap(),
  mdx(),
 ],
 markdown: {
  remarkPlugins: [
   remarkMath,
   remarkReadingTime,
   remarkExcerpt,
   remarkGithubAdmonitionsToDirectives,
   remarkDirective,
   remarkSectionize,
   parseDirectiveNode,
  ],
  rehypePlugins: [
   rehypeKatex,
   rehypeSlug,
   [
    rehypeComponents,
    {
     components: {
+      codeberg: CodebergCardComponent,
      github: GithubCardComponent,
      note: (x, y) => AdmonitionComponent(x, y, "note"),
      tip: (x, y) => AdmonitionComponent(x, y, "tip"),
      important: (x, y) => AdmonitionComponent(x, y, "important"),
      caution: (x, y) => AdmonitionComponent(x, y, "caution"),
      warning: (x, y) => AdmonitionComponent(x, y, "warning"),
     },
    },
   ],
   [
    rehypeAutolinkHeadings,
    {
     behavior: "append",
     properties: {
      className: ["anchor"],
     },
     content: {
      type: "element",
      tagName: "span",
      properties: {
       className: ["anchor-icon"],
       "data-pagefind-ignore": true,
      },
      children: [
       {
        type: "text",
        value: "#",
       },
      ],
     },
    },
   ],
  ],
 },
 vite: {
  build: {
   rollupOptions: {
    onwarn(warning, warn) {
     // temporarily suppress this warning
     if (
      warning.message.includes("is dynamically imported by") &&
      warning.message.includes("but also statically imported by")
     ) {
      return;
     }
     warn(warning);
    },
   },
  },
 },
});

然后,在 markdown-extend.styl 添加以下内容:

.custom-md

  blockquote.admonition
    .bdm-title
      display: flex
      align-items: center
      margin-bottom: -.9rem
      font-weight: bold

      &:before
        content: ' '
        display: inline-block
        font-size: inherit
        overflow: visible
        margin-right: .6rem
        height: 1em
        width: 1em
        vertical-align: -.126em
        mask-size: contain
        mask-position: center
        mask-repeat: no-repeat
        transform: translateY(-0.0625rem)
    &.bdm-tip
      .bdm-title
        color: var(--admonitions-color-tip)

        &:before
          background: var(--admonitions-color-tip)
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' width='16' height='16' aria-hidden='true'%3E%3Cpath d='M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z'%3E%3C/path%3E%3C/svg%3E")

      &:before
        background: var(--admonitions-color-tip)
    &.bdm-note
      .bdm-title
        color: var(--admonitions-color-note)

        &:before
          background: var(--admonitions-color-note)
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' width='16' height='16' aria-hidden='true'%3E%3Cpath fill='var(--admonitions-color-tip)' d='M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z'%3E%3C/path%3E%3C/svg%3E")

      &:before
        background: var(--admonitions-color-note)
    &.bdm-important
      .bdm-title
        color: var(--admonitions-color-important)

        &:before
          background: var(--admonitions-color-important)
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' width='16' height='16' aria-hidden='true'%3E%3Cpath d='M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z'%3E%3C/path%3E%3C/svg%3E")

      &:before
        background: var(--admonitions-color-important)
    &.bdm-warning
      .bdm-title
        color: var(--admonitions-color-warning)

        &:before
          background: var(--admonitions-color-warning)
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' width='16' height='16' aria-hidden='true'%3E%3Cpath d='M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z'%3E%3C/path%3E%3C/svg%3E")

      &:before
        background: var(--admonitions-color-warning)
    &.bdm-caution
      .bdm-title
        color: var(--admonitions-color-caution)

        &:before
          background: var(--admonitions-color-caution)
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' width='16' height='16' aria-hidden='true'%3E%3Cpath d='M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z'%3E%3C/path%3E%3C/svg%3E")

      &:before
        background: var(--admonitions-color-caution)

  img
    border-radius: 0.75rem

  hr
    border-color: var(--line-divider)
    border-style: dashed

  iframe
    border-radius: 0.75rem
    margin-left: auto
    margin-right: auto
    max-width: 100%

a.card-github
  display: block
  background: var(--license-block-bg)
  position: relative
  margin: 0.5rem 0
  padding: 1.1rem 1.5rem 1.1rem 1.5rem
  color: var(--tw-prose-body)
  border-radius: var(--radius-large)
  text-decoration-thickness: 0px
  text-decoration-line: none

  &:hover
    background-color: var(--btn-regular-bg-hover)

    .gc-titlebar
      color: var(--btn-content)

    .gc-stars, .gc-forks, .gc-license, .gc-description
      color: var(--tw-prose-headings)

      &:before
        background-color: var(--tw-prose-headings)

  &:active
    scale: .98
    background-color: var(--btn-regular-bg-active);

  .gc-titlebar
    display: flex
    align-items: center
    justify-content: space-between
    margin-bottom: 0.5rem
    color: var(--tw-prose-headings)
    font-size: 1.25rem
    font-weight: 500

    .gc-titlebar-left
      display: flex
      flex-flow: row nowrap
      gap: 0.5rem

    .gc-repo
      font-weight: bold

    .gc-owner
      font-weight: 300
      position: relative
      display: flex
      flex-flow: row nowrap
      gap: 0.5rem
      align-items: center

    .gc-avatar
      display: block
      overflow: hidden
      width: 1.5rem
      height: 1.5rem
      margin-top: -0.1rem
      background-color: var(--primary)
      background-size: cover
      border-radius: 50%

  .gc-description
    margin-bottom: 0.7rem
    font-size: 1rem
    font-weight: 300
    line-height: 1.5rem
    color: var(--tw-prose-body)

  .gc-infobar
    display: flex
    flex-flow: row nowrap
    gap: 1.5rem
    color: var(--tw-prose-body)
    width: fit-content

  .gc-language
    display: none

  .gc-stars, .gc-forks, .gc-license, .github-logo
    font-weight: 500
    font-size: 0.875rem
    opacity: 0.9;

    &:before
      content: ' '
      display: inline-block
      height: 1.3em
      width: 1.3em
      margin-right: .4rem
      vertical-align: -.24em
      font-size: inherit
      background-color: var(--tw-prose-body)
      overflow: visible
      mask-size: contain
      mask-position: center
      mask-repeat: no-repeat
      transition-property: background-color, background;
      transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1)
      transition-duration: 0.15s

  .gc-stars
    &:before
      mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='16' viewBox='0 0 16 16' version='1.1' width='16'%3E%3Cpath d='M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z'%3E%3C/path%3E%3C/svg%3E")

  .gc-license
    &:before
      margin-right: .5rem
      mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='16' viewBox='0 0 16 16' version='1.1' width='16'%3E%3Cpath d='M8.75.75V2h.985c.304 0 .603.08.867.231l1.29.736c.038.022.08.033.124.033h2.234a.75.75 0 0 1 0 1.5h-.427l2.111 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.006.005-.01.01-.045.04c-.21.176-.441.327-.686.45C14.556 10.78 13.88 11 13 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L12.178 4.5h-.162c-.305 0-.604-.079-.868-.231l-1.29-.736a.245.245 0 0 0-.124-.033H8.75V13h2.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1 0-1.5h2.5V3.5h-.984a.245.245 0 0 0-.124.033l-1.289.737c-.265.15-.564.23-.869.23h-.162l2.112 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.016.015-.045.04c-.21.176-.441.327-.686.45C4.556 10.78 3.88 11 3 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L2.178 4.5H1.75a.75.75 0 0 1 0-1.5h2.234a.249.249 0 0 0 .125-.033l1.288-.737c.265-.15.564-.23.869-.23h.984V.75a.75.75 0 0 1 1.5 0Zm2.945 8.477c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L13 6.327Zm-10 0c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L3 6.327Z'%3E%3C/path%3E%3C/svg%3E")

  .gc-forks
    &:before
      mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='16' viewBox='0 0 16 16' version='1.1' width='16'%3E%3Cpath d='M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z'%3E%3C/path%3E%3C/svg%3E")

  .github-logo
    font-size: 1.25rem

    &:before
      background-color: var(--tw-prose-headings)
      margin-right: 0
      mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='31' height='32' viewBox='0 0 496 512'%3E%3Cpath fill='%23a1f7cb' d='M165.9 397.4c0 2-2.3 3.6-5.2 3.6c-3.3.3-5.6-1.3-5.6-3.6c0-2 2.3-3.6 5.2-3.6c3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9c2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9c.3 2 2.9 3.3 5.9 2.6c2.9-.7 4.9-2.6 4.6-4.6c-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2c12.8 2.3 17.3-5.6 17.3-12.1c0-6.2-.3-40.4-.3-61.4c0 0-70 15-84.7-29.8c0 0-11.4-29.1-27.8-36.6c0 0-22.9-15.7 1.6-15.4c0 0 24.9 2 38.6 25.8c21.9 38.6 58.6 27.5 72.9 20.9c2.3-16 8.8-27.1 16-33.7c-55.9-6.2-112.3-14.3-112.3-110.5c0-27.5 7.6-41.3 23.6-58.9c-2.6-6.5-11.1-33.3 2.6-67.9c20.9-6.5 69 27 69 27c20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27c13.7 34.7 5.2 61.4 2.6 67.9c16 17.7 25.8 31.5 25.8 58.9c0 96.5-58.9 104.2-114.8 110.5c9.2 7.9 17 22.9 17 46.4c0 33.7-.3 75.4-.3 83.6c0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252C496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2c1.6 1.6 3.9 2.3 5.2 1c1.3-1 1-3.3-.7-5.2c-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9c1.6 1 3.6.7 4.3-.7c.7-1.3-.3-2.9-2.3-3.9c-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2c2.3 2.3 5.2 2.6 6.5 1c1.3-1.3.7-4.3-1.3-6.2c-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9c1.6 2.3 4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2c-1.4-2.3-4-3.3-5.6-2'/%3E%3C/svg%3E")

a.card-github.fetch-waiting
  pointer-events: none
  opacity: 0.7
  transition: opacity 0.15s ease-in-out

  .gc-description, .gc-infobar, .gc-avatar
    background-color: var(--tw-prose-body)
    color: transparent
    opacity: 0.5;
    animation: pulsate 2s infinite linear
    user-select: none

    &:before
      background-color: transparent

  .gc-repo
    margin-left: -0.1rem

  .gc-description, .gc-infobar
    border-radius: 0.5rem

a.card-codeberg
  display: block
  background: var(--license-block-bg)
  position: relative
  margin: 0.5rem 0
  padding: 1.1rem 1.5rem 1.1rem 1.5rem
  color: var(--tw-prose-body)
  border-radius: var(--radius-large)
  text-decoration-thickness: 0px
  text-decoration-line: none

  &:hover
    background-color: var(--btn-regular-bg-hover)

    .gc-titlebar
      color: var(--btn-content)

    .gc-stars, .gc-forks, .gc-license, .gc-description
      color: var(--tw-prose-headings)

      &:before
        background-color: var(--tw-prose-headings)

  &:active
    scale: .98
    background-color: var(--btn-regular-bg-active);

  .gc-titlebar
    display: flex
    align-items: center
    justify-content: space-between
    margin-bottom: 0.5rem
    color: var(--tw-prose-headings)
    font-size: 1.25rem
    font-weight: 500

    .gc-titlebar-left
      display: flex
      flex-flow: row nowrap
      gap: 0.5rem

    .gc-repo
      font-weight: bold

    .gc-owner
      font-weight: 300
      position: relative
      display: flex
      flex-flow: row nowrap
      gap: 0.5rem
      align-items: center

    .gc-avatar
      display: block
      overflow: hidden
      width: 1.5rem
      height: 1.5rem
      margin-top: -0.1rem
      background-color: var(--primary)
      background-size: cover
      border-radius: 50%

  .gc-description
    margin-bottom: 0.7rem
    font-size: 1rem
    font-weight: 300
    line-height: 1.5rem
    color: var(--tw-prose-body)

  .gc-infobar
    display: flex
    flex-flow: row nowrap
    gap: 1.5rem
    color: var(--tw-prose-body)
    width: fit-content

  .gc-language
    display: none

  .gc-stars, .gc-forks, .gc-license, .codeberg-logo
    font-weight: 500
    font-size: 0.875rem
    opacity: 0.9;

    &:before
      content: ' '
      display: inline-block
      height: 1.3em
      width: 1.3em
      margin-right: .4rem
      vertical-align: -.24em
      font-size: inherit
      background-color: var(--tw-prose-body)
      overflow: visible
      mask-size: contain
      mask-position: center
      mask-repeat: no-repeat
      transition-property: background-color, background;
      transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1)
      transition-duration: 0.15s

  .gc-stars
    &:before
      mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='16' viewBox='0 0 16 16' version='1.1' width='16'%3E%3Cpath d='M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z'%3E%3C/path%3E%3C/svg%3E")

  .gc-license
    display: none

  .gc-forks
    &:before
      mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='16' viewBox='0 0 16 16' version='1.1' width='16'%3E%3Cpath d='M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z'%3E%3C/path%3E%3C/svg%3E")

  .codeberg-logo
    font-size: 1.25rem

    &:before
      background-color: var(--tw-prose-headings)
      margin-right: 0
      mask-image: url("https://codeberg.org/Codeberg/Design/raw/commit/ac514aa9aaa2457d4af3c3e13df3ab136d22a49a/logo/icon/svg/codeberg-logo_icon_blue.svg")

a.card-codeberg.fetch-waiting
  pointer-events: none
  opacity: 0.7
  transition: opacity 0.15s ease-in-out

  .gc-description, .gc-infobar, .gc-avatar
    background-color: var(--tw-prose-body)
    color: transparent
    opacity: 0.5;
    animation: pulsate 2s infinite linear
    user-select: none

    &:before
      background-color: transparent

  .gc-repo
    margin-left: -0.1rem

  .gc-description, .gc-infobar
    border-radius: 0.5rem

a.card-codeberg.fetch-error
  pointer-events: all
  opacity: 1

@keyframes pulsate
  0%
    opacity: 0.15
  50%
    opacity: 0.25
  100%
    opacity: 0.15

.card-codeberg, .card-github, .gc-description, .gc-titlebar, .gc-stars, .gc-forks, .gc-license, .gc-avatar, .codeberg-logo, .github-logo
  transition-property: all
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1)
  transition-duration: 0.15s

7. 增加图片标题

参考这个 PR

8. 更改字体

参考这篇文章

9. 亮色代码块

参考这个 PR

10. GitHub 文件卡片

参考这个 PR

未完待续...

原链接:https://blog.clina.top/posts/changes-fuwari/

1
3
登录后参与讨论。
u/udc2b6nr 广告
QuicksilverVPN

快银 VPN,一键连接全球节点,线路稳定、延迟低。支持 Windows、macOS 等多平台,TUN 全局模式覆盖全部应用流量。无需复杂配置,下载即用。

umami.dnsl.top 了解更多

3 条回复

排序
  1. Clina 钻石 楼主 钻石会员 6 个月前

    没人看吗

    1
  2. srv 王者 3 YEARS 6 个月前

    挺不错的

    0
  3. JinMukun 版主 钻石 3 YEARS 6 个月前

    支持大佬

    0