### Bun Mirror Configuration Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/getting-started.mdx Configures a mirror site for Bun to potentially speed up installations. Create a 'bunfig.toml' file in the project root directory with the specified content. ```toml [install] registry = "" ``` -------------------------------- ### Start Astro Dev Server Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/getting-started.mdx Starts the Astro development server to preview your project locally. Navigate to your project directory first using 'cd'. Supports multiple package managers. ```shell bun dev ``` ```shell pnpm dev ``` ```shell yarn run dev ``` ```shell npm run dev ``` -------------------------------- ### Install Astro Theme Pure via Template Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/getting-started.mdx Installs the Astro Theme Pure using a template repository. This method is lightweight and simple. It requires a package manager like Bun, pnpm, yarn, or npm. ```shell bun create astro@latest --template cworld1/astro-theme-pure ``` ```shell pnpm create astro@latest --template cworld1/astro-theme-pure ``` ```shell yarn create astro --template cworld1/astro-theme-pure ``` ```shell npm create astro@latest -- --template cworld1/astro-theme-pure ``` -------------------------------- ### Clone Astro Theme Pure Repository Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/getting-started.mdx Installs the Astro Theme Pure by forking the repository and cloning it locally. This method is easy to update but requires Git skills. Replace '' with your GitHub username. ```shell git clone https://github.com//astro-theme-pure.git ``` -------------------------------- ### Configure Site Metadata in site.config.ts Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/getting-started.mdx Shows how to configure essential site metadata such as author, title, site URL, and description within the `src/site.config.ts` file. ```typescript export const theme: ThemeUserConfig = { author: 'CWorld', title: 'Astro Theme Pure', site: 'https://astro-pure.js.org', description: 'Stay hungry, stay foolish', // ... } export const integ: IntegrationUserConfig = { /* ... */ } // ... ``` -------------------------------- ### Local Development Commands Source: https://github.com/cworld1/astro-theme-pure/blob/main/README.md Commands for cloning the repository, installing dependencies, starting the development server, building the project, previewing the build, and creating new posts using Bun. ```shell git clone https://github.com/cworld1/astro-theme-pure.git cd astro-theme-pure ``` ```shell bun install ``` ```shell bun dev ``` ```shell bun run build ``` ```shell bun preview ``` ```shell bun new-post ``` -------------------------------- ### Install remark-math and rehype-katex Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/integrations/others.mdx Installs the necessary npm packages, `remark-math` for parsing LaTeX and `rehype-katex` for rendering it, using bun package manager. ```shell bun install remark-math rehype-katex ``` -------------------------------- ### Create Step-by-Step Guides with Astro-Pure JSX Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/integrations/components.mdx Shows how to use the Steps component from astro-pure/user to create ordered lists or guides. Supports nested content within steps. ```jsx import { Steps } from 'astro-pure/user' How to Yi Jian San Lian: 1. Dian Zan 2. Tou Bi 3. Shou Cang Or GuanZhu sometimes. ``` -------------------------------- ### Simple Astro Markdown Article Example Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/content.mdx A concise example of a Markdown file for Astro content, showcasing the minimal required frontmatter fields: title, description, and publishDate. This serves as a basic template for new articles. ```markdown --- title: Simple Article description: Just another simple article. publishDate: 2024-07-26 --- I like writing simple articles. ``` -------------------------------- ### Install @astrojs/node with Bun Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/deployment.mdx This command installs the Node.js adapter for Astro using the Bun package manager. This is a prerequisite for deploying your Astro site with a Node.js server. ```shell bun add '@astrojs/node' ``` -------------------------------- ### Astro Component Import Example Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/advanced/customize.mdx Demonstrates importing basic components from the 'astro-pure/components/basic' module in an Astro layout file. ```astro --- import { Footer, Header, ThemeProvider } from 'astro-pure/components/basic' import type { SiteMeta } from 'astro-pure/types' // ... --- ``` -------------------------------- ### Plain Text Example Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/blog/test.md This snippet demonstrates a basic block of plain text content. It serves as a simple example of unformatted text within a documentation context. ```plaintext test test ``` -------------------------------- ### Remove Docs Content Collection in content.config.ts Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/getting-started.mdx Illustrates removing the 'docs' content collection definition from `src/content.config.ts`. This includes removing the `defineCollection` call and updating the `collections` export. ```typescript const docs = defineCollection({ // [!code --] loader: glob({ base: './src/content/docs', pattern: '**/*.{md,mdx}' }), // [!code --] schema: ({ image }) => // [!code --] z.object({ // [!code --] ... // [!code --] }) // [!code --] }) // [!code --] export const collections = { blog, docs } // [!code --] export const content = { blog } // [!code ++] ``` -------------------------------- ### Astro Component Export Example Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/advanced/customize.mdx Shows how components are exported from a module index file within the theme's source code. ```ts export { default as Footer } from './Footer.astro' export { default as Header } from './Header.astro' export { default as ThemeProvider } from './ThemeProvider.astro' ``` -------------------------------- ### Markdown Lists Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/blog/markdown/index.md Provides examples of creating both unordered (bulleted) and ordered (numbered) lists in Markdown. Supports nesting of list items. ```markdown - 1 - 2 - 3 ``` ```markdown 1. GPT-4 2. Claude Opus 3. LLaMa ``` -------------------------------- ### Remove Docs Menu Item in site.config.ts Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/getting-started.mdx Demonstrates removing the 'Docs' link from the header menu configuration in `src/site.config.ts`. This involves updating the `header.menu` array to exclude the documentation entry. ```typescript export const theme: ThemeUserConfig = { // ... /** Configure the header of your site. */ header: { menu: [ { title: 'Blog', link: '/blog' }, { title: 'Docs', link: '/docs' }, // [!code --] // ... ], }, } ``` -------------------------------- ### Replace Assets in src/assets Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/blog/customize/index.md Replace client-rendered avatars, sponsorship QR codes, and other images stored in the src/assets directory with your own custom images. ```File Path src/assets/ ``` -------------------------------- ### Astro Theme Pure CLI Commands Source: https://github.com/cworld1/astro-theme-pure/blob/main/packages/pure/README.md Provides command-line interface tools for managing the Astro Theme Pure blog. These commands allow users to view help, get information about the theme, and create new blog posts. ```shell # See all commands astro-pure help # Get the info of astro-pure astro-pure info # Create a new post in the blog astro-pure new [options] ``` -------------------------------- ### Markdown Code Blocks Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/blog/markdown/index.md Demonstrates how to embed larger blocks of code, often with syntax highlighting. The example uses JavaScript syntax highlighting. ```markdown ```js // calculate fibonacci function fibonacci(n) { if (n <= 1) return 1 const result = fibonacci(n - 1) + fibonacci(n - 2) // [!code --] return fibonacci(n - 1) + fibonacci(n - 2) // [!code ++] } ``` ``` -------------------------------- ### Astro Markdown Content Structure Example Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/content.mdx Demonstrates the structure of a Markdown file used for content in Astro, including essential frontmatter fields like title, description, publishDate, heroImage, draft status, language, and comment settings. It also touches upon asset placement and handling. ```markdown --- title: 'First Article' # (Required, max 60) description: 'I like writing articles.' # (Required, 10 to 160) publishDate: '2024-11-30 00:08:00' # (Required, Date) tags: - Markdown # (Also can write format like next line) heroImage: { src: './thumbnail.jpg', alt: 'an image targetting my article', color: '#B4C6DA' } # thumbnail.jpg should be in the same folder as the article draft: false # (set true will only show in development) language: 'English' # (String as you like) comment: true # (set false will disable comment, even if you've enabled it in site-config) --- ## This is a title This is a paragraph. ``` -------------------------------- ### Basic Astro Page Component Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/content.mdx A fundamental example of an Astro page component using the .astro file extension. This snippet demonstrates a minimal structure that renders a complete HTML document, including head and body elements. ```astro --- --- My Homepage

Welcome to my website!

``` -------------------------------- ### Add New Tools Icons Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/blog/customize/index.md To add new icons for tools, place the new icon files within the src/icons directory. It is recommended to source icons from platforms like Iconify or Icones for consistency. ```File Path src/icons/ ``` -------------------------------- ### Configure Node Server Adapter in Astro Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/setup/deployment.mdx This snippet demonstrates how to install and configure the `@astrojs/node` adapter for deploying your Astro site with a Node.js server. It includes switching from a serverless adapter and setting the mode to 'standalone'. ```ts import vercelServerless from '@astrojs/vercel/serverless' // [!code --] import node from '@astrojs/node' // [!code ++] export default defineConfig({ // ... adapter: vercelServerless(), // [!code --] adapter: node({ mode: 'standalone' }), // [!code ++] integrations: [ outputCopier({ // [!code --] integ: ['sitemap', 'pagefind'] // [!code --] }) // [!code --] ] }) ``` -------------------------------- ### Waline Configuration Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/integrations/comment.mdx Configure the Waline comment system by setting the `enable` flag and providing the `server` link. Additional configurations for features like emoji and pageview can be passed via `additionalConfigs`. This setup is done in `src/site.config.ts`. ```ts export const integ: IntegrationUserConfig = { // ... waline: { enable: true, // Server service link server: 'https://astro-theme-pure-waline.arthals.ink/', // [!code highlight] // Refer https://waline.js.org/en/guide/features/emoji.html emoji: ['bmoji', 'weibo'], // Refer https://waline.js.org/en/reference/client/props.html additionalConfigs: { pageview: true, comment: true // ... } } } ``` -------------------------------- ### Astro Aside Component Usage (Astro) Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/blog/improve-concentration/index.mdx This example shows the usage of a custom 'Aside' component within an Astro template. The component is configured with a 'type' and 'title' attribute, and it wraps content intended to be displayed in a distinct sidebar or tip section. This pattern is common for enhancing content presentation in static site generators. ```html ``` -------------------------------- ### Configure Tailwind CSS for Astro Theme Pure Source: https://github.com/cworld1/astro-theme-pure/blob/main/packages/pure/README.md Integrates astro-pure components into Tailwind CSS's content configuration to ensure proper styling. This setup requires Tailwind CSS to be installed and configured in your Astro project. ```js // tailwind.config.mjs /** @type {import('tailwindcss').Config} */ const config = { content: [ // Add astro-pure components in the tailwindcss render config './node_modules/astro-pure/components/**/*.astro' ] } export default config ``` -------------------------------- ### Support Web Images for heroImage Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/advanced/faq.md Demonstrates how to configure web images for the `heroImage` property. It requires setting `inferSize: true` to automatically fetch the image dimensions. ```yaml heroImage: { src: 'https://img.tukuppt.com/ad_preview/00/15/09/5e715a320b68e.jpg!/fw/980', inferSize: true } ``` -------------------------------- ### Icon Component Usage and Preview Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/integrations/components.mdx Demonstrates how to use the `Icon` component for single instances and provides a comprehensive preview of all available icons. Each icon can be copied to the clipboard via a click event. ```jsx import { Icon } from 'astro-pure/user' import { Icons as allIcons } from 'astro-pure/libs' import { Button } from 'astro-pure/user' Single use: Preview all icons available (click button to copy):
{ Object.keys(allIcons).map(icon => { const script = `navigator.clipboard.writeText('${icon}');document.dispatchEvent(new CustomEvent('toast',{detail:{message:'Copied "${icon}" to clipboard!'}}))` return ( ) }) }
``` -------------------------------- ### Use Button Component Source: https://github.com/cworld1/astro-theme-pure/blob/main/src/content/docs/advanced/thanks.mdx Illustrates the usage of the `Button` component from the `astro-pure/user` library to create interactive links. It shows how to specify the `href`, `target`, `title`, and `style` attributes for customization. ```astro