### Start Development Server (Bash) Source: https://github.com/house-of-giants/wp-block-docs/blob/main/README.md Starts the development server for the WordPress Block Documentation project. This command is used after installing dependencies to preview changes locally. Requires Node.js 18+ and pnpm. ```bash pnpm run dev ``` -------------------------------- ### Install Project Dependencies (Bash) Source: https://github.com/house-of-giants/wp-block-docs/blob/main/README.md Installs project dependencies using pnpm after cloning the repository. Requires Node.js 18+ and pnpm to be installed. ```bash git clone https://github.com/house-of-giants/wp-block-docs.git cd wp-block-docs pnpm install ``` -------------------------------- ### Setup and Repository Management Source: https://github.com/house-of-giants/wp-block-docs/blob/main/CONTRIBUTING.md Commands for cloning the repository, managing remotes, and syncing local branches with the upstream source. ```bash git clone https://github.com/YOUR_USERNAME/wp-block-docs.git cd wp-block-docs git remote add upstream https://github.com/house-of-giants/wp-block-docs.git git checkout main git pull upstream main git push origin main git checkout -b feature/your-feature-name ``` -------------------------------- ### Set Up Local Development Environment (Bash) Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt This section outlines the local development workflow using Vite, React, and TypeScript. It includes prerequisites, cloning the repository, installing dependencies, and running development and build commands. ```bash # Prerequisites: Node.js 18+, pnpm # Clone and install git clone https://github.com/house-of-giants/wp-block-docs.git cd wp-block-docs pnpm install # Development server (http://localhost:8080) pnpm run dev # Production build pnpm run build # Type checking pnpm run typecheck # Run tests pnpm test # Format code pnpm run format.fix ``` -------------------------------- ### WordPress Heading Block Examples Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt Provides examples of the WordPress Heading block, demonstrating different heading levels (H1-H6), anchor link creation, and custom styling for typography and color. Essential for structuring content and SEO. ```html

Your Heading Text

Page Title (H1)

Main Section (H2)

Subsection (H3)

Section With Anchor

Custom Styled Heading

``` -------------------------------- ### Local Development and Build Commands Source: https://github.com/house-of-giants/wp-block-docs/blob/main/CONTRIBUTING.md Essential commands for installing dependencies, running the development server, and executing quality assurance tasks like type checking and testing. ```bash pnpm install pnpm run dev pnpm run typecheck pnpm test ``` -------------------------------- ### Available Development Scripts (Bash) Source: https://github.com/house-of-giants/wp-block-docs/blob/main/README.md Lists the available npm scripts for managing the development workflow of the WordPress Block Documentation project, including starting the dev server, building for production, type checking, testing, and formatting. ```bash pnpm run dev # Start development server pnpm run build # Build for production pnpm run typecheck # TypeScript type checking pnpm test # Run test suite pnpm run format.fix # Format code with Prettier ``` -------------------------------- ### WordPress Paragraph Block Examples Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt Illustrates various ways to use the WordPress Paragraph block, from simple text to advanced styling with drop caps, custom typography, and rich text formatting. It shows how attributes and inline styles are applied. ```html

This is a simple paragraph with some text content.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. The first letter will be styled as a large drop cap.

Styled paragraph with custom typography settings.

This paragraph contains bold text, italic text, and highlighted text. You can also use strikethrough and superscript or subscript.

``` -------------------------------- ### Implement Image Block with Media Features Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt Shows how to implement the WordPress Image block with support for captions, external links, lightbox functionality, and custom dimensions. These examples use the standard block markup format to define image attributes. ```html
Descriptive alt text
Landscape photo
Photo taken in Yosemite National Park
Gallery preview
Click to enlarge
``` -------------------------------- ### Create List Blocks in WordPress Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt The List block supports ordered and unordered lists with nested items. It allows for advanced configurations such as custom start values and list types. ```html
  1. Item E
``` -------------------------------- ### Development Commands for Project Management Source: https://github.com/house-of-giants/wp-block-docs/blob/main/AGENTS.md A collection of essential development commands for managing the project. These commands cover starting the development server, building for production, performing TypeScript validation, and running tests using Vitest. ```bash pnpm run dev # Start dev server pnpm run build # Production build pnpm run typecheck # TypeScript validation pnpm test # Run Vitest tests ``` -------------------------------- ### Combine CSS Classes with cn Utility Source: https://github.com/house-of-giants/wp-block-docs/blob/main/AGENTS.md This example illustrates the usage of the `cn` utility function, which combines `clsx` and `tailwind-merge`. It's designed to conditionally apply Tailwind CSS classes and merge them with base classes and user-provided overrides for flexible styling. ```typescript // cn utility usage className={cn( "base-classes", { "conditional-class": condition }, props.className // User overrides )} ``` -------------------------------- ### Project Structure Overview (Text) Source: https://github.com/house-of-giants/wp-block-docs/blob/main/README.md Illustrates the directory structure of the WordPress Block Documentation project, highlighting key directories like 'client' for the frontend application and 'public' for static assets. ```text ├── client/ # React frontend application │ ├── components/ # Reusable UI components │ │ ├── ui/ # Base UI components (buttons, cards, etc.) │ │ ├── PageHeader.tsx # Reusable page header component │ │ ├── ContentSection.tsx # Content section wrapper │ │ └── SearchModal.tsx # Global search functionality │ ├── pages/ # Route components │ │ ├── Index.tsx # Homepage │ │ ├── BlockIndex.tsx # Block directory │ │ ├── Resources.tsx # Developer resources │ │ └── blocks/ # Individual block documentation │ ├── hooks/ # Custom React hooks │ ├── lib/ # Utility functions │ └── global.css # Global styles and theme └── public/ # Static assets ``` -------------------------------- ### Configure Columns Blocks Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt Shows how to structure multi-column layouts, including custom width percentages, vertical alignment, and mobile stacking behavior. ```html
``` -------------------------------- ### Implement Button Blocks Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt Demonstrates how to create call-to-action buttons with support for external links, security attributes, custom colors, and width adjustments. ```html
Click Me
Learn More
External Link
``` -------------------------------- ### Define Query Loop Blocks Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt Illustrates how to fetch and display dynamic content using the Query Loop block, supporting pagination, category filtering, and main query inheritance. ```html
``` -------------------------------- ### Adding New Block Documentation (Text) Source: https://github.com/house-of-giants/wp-block-docs/blob/main/README.md Outlines the steps required to add documentation for a new WordPress block within the project. This involves creating a new page, using a layout component, updating routing and search data, and adding navigation links. ```text 1. Create a new page in `client/pages/blocks/` 2. Follow the existing pattern using `BlockPageLayout` component 3. Add the route to `client/App.tsx` 4. Update the search data in `client/components/SearchModal.tsx` 5. Add navigation links in `client/components/DocLayout.tsx` ``` -------------------------------- ### Use React Components for WP Block Documentation (TSX) Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt This project utilizes reusable React components for displaying WordPress block documentation. Features include syntax highlighting, copy-to-clipboard functionality, and structured layout components. ```tsx import { WPBlockCodeBlock } from "@/components/WPBlockCodeBlock"; import { CodeBlock } from "@/components/CodeBlock"; import { PageHeader } from "@/components/PageHeader"; import { ContentSection } from "@/components/ContentSection"; // WordPress block code with syntax highlighting

Hello World

`} showCopy={true} maxHeight="400px" /> // Generic code block // Page header with icon and badges // Content section wrapper {/* Section content */} ``` -------------------------------- ### Implement Group Block with Layout and Styling Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt Demonstrates various configurations for the WordPress Group block, including padding, margin, background colors, constrained layouts, and semantic HTML tags. These blocks serve as containers for grouping other content blocks. ```html
``` -------------------------------- ### Highlight WordPress Block Markup with WPBlockHighlighter API (TypeScript) Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt The WPBlockHighlighter API provides custom syntax highlighting for WordPress block markup, supporting block comments, JSON attributes, and HTML. It parses code into tokens and can convert these tokens into highlighted HTML. ```typescript import { WPBlockHighlighter, HighlightToken } from "@/lib/wp-block-highlighter"; // Highlight WordPress block code const code = `

Hello World

`; // Parse code into tokens const tokens: HighlightToken[] = WPBlockHighlighter.highlight(code); // Token types: // - "block-comment-start" / "block-comment-end": // - "block-name": paragraph, group, image, etc. // - "block-attributes": JSON attributes like {"dropCap":true} // - "html-tag": HTML elements // - "html-attribute": class, style, href, etc. // - "html-value": attribute values // - "text": regular text content // - "error": invalid JSON or syntax errors // Convert tokens to highlighted HTML const highlightedHtml: string = WPBlockHighlighter.tokensToHtml(tokens); ``` -------------------------------- ### Define SPA Routes with React Router 6 Source: https://github.com/house-of-giants/wp-block-docs/blob/main/AGENTS.md This snippet demonstrates how to define routes for a Single Page Application (SPA) using React Router 6. It shows the basic structure for setting up routes, including a home page and a catch-all route for 404 pages. Ensure custom routes are placed before the catch-all route. ```typescript import { BrowserRouter, Routes, Route } from "react-router-dom"; } /> {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} } /> ; ``` -------------------------------- ### Configure Gallery Blocks in WordPress Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt The Gallery block displays image collections in responsive grids. It supports column configuration, image linking, and captions. ```html ``` -------------------------------- ### Implement Navigation Block in WordPress Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt The Navigation block facilitates responsive site menus. It supports referencing existing menus, inline link definitions, submenus, and custom styling via block attributes. ```html ``` -------------------------------- ### WordPress Block Syntax Structure Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt Demonstrates the fundamental HTML comment structure used by WordPress Gutenberg blocks, including basic and self-closing block formats. This syntax is crucial for programmatic block manipulation. ```html

``` -------------------------------- ### Access Block Properties Definitions with TypeScript Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt The block properties system offers comprehensive attribute definitions for all WordPress blocks. You can retrieve properties for specific block types or access universal properties common to all blocks. ```typescript import { getBlockProperties, universalBlockProperties, PropertyCategory, BlockProperty } from "@/lib/block-properties"; // Get all properties for a specific block type const groupProperties: PropertyCategory[] = getBlockProperties("group"); // Includes universal properties + group-specific properties // Universal properties available to ALL blocks: // - className, anchor, lock (Core Attributes) // - style.color.*, textColor, backgroundColor (Styling) // - style.typography.*, fontSize (Typography) // - style.spacing.* (Spacing & Layout) // - style.border.* (Border & Outline) // - style.dimensions.* (Dimensions) // Supported block types: type BlockType = "group" | "columns" | "image" | "heading" | "paragraph" | "button" | "query-loop" | "navigation" | "list" | "quote" | "gallery"; ``` -------------------------------- ### Add New Page Route in React App Source: https://github.com/house-of-giants/wp-block-docs/blob/main/AGENTS.md This snippet outlines the steps to add a new page route to the React application. It involves creating the page component in the `client/pages/` directory and then defining the corresponding route in `client/App.tsx`. ```typescript 1. Create component in `client/pages/MyPage.tsx` 2. Add route in `client/App.tsx`: } /> ``` -------------------------------- ### Validate WordPress Block Markup with TypeScript Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt The Block Validator tool checks WordPress block markup for syntax errors, accessibility issues, and adherence to best practices. It returns a ValidationResult object containing the type of issue, a message, and optional suggestions or fixed code. ```typescript // Block validation result interface interface ValidationResult { type: "error" | "warning" | "success" | "info"; message: string; suggestion?: string; fixedCode?: string; } // Common validation checks performed: // - Valid JSON syntax in block attributes // - Matching opening and closing block comments // - Alt text presence on images // - Single H1 per page for SEO // - rel="noopener noreferrer" on external links // - Valid spacing preset formats // - Semantic HTML usage recommendations ``` -------------------------------- ### Define Quote Blocks in WordPress Source: https://context7.com/house-of-giants/wp-block-docs/llms.txt The Quote block is used for testimonials or highlighted text. It supports citations, custom CSS classes for styling, and inline typography attributes. ```html

The web is for everyone.

Tim Berners-Lee
``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.