|
| 1 | +--- |
| 2 | +title: Editing with VS Code |
| 3 | +description: How to use Visual Studio Code to contribute to the Zen Browser documentation. |
| 4 | +--- |
| 5 | + |
| 6 | +Visual Studio Code (VS Code) is a popular and powerful code editor that works well for editing Zen Browser documentation, especially with the right extensions. |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | + |
| 10 | +- [**Visual Studio Code**](https://code.visualstudio.com/) installed on your machine. |
| 11 | + - *Note: Popular forks of VS Code, such as [VSCodium](https://vscodium.com/), should also work well.* |
| 12 | + |
| 13 | +## Recommended Extension: MDX |
| 14 | + |
| 15 | +To get the best experience editing `.mdx` files in VS Code, we recommend installing the official MDX extension. |
| 16 | + |
| 17 | +- **Extension Name:** MDX |
| 18 | +- **Publisher:** unifiedjs |
| 19 | +- **Marketplace Link:** [MDX - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx) |
| 20 | + |
| 21 | +### Benefits |
| 22 | + |
| 23 | +- **Syntax Highlighting:** Provides accurate syntax highlighting for both Markdown and JSX components within `.mdx` files. |
| 24 | +- **IntelliSense:** Offers autocompletion and suggestions for MDX syntax and potentially imported components. |
| 25 | +- **Error Checking:** Helps identify syntax errors in your MDX code. |
| 26 | + |
| 27 | +### Installation |
| 28 | + |
| 29 | +1. Open VS Code. |
| 30 | +2. Go to the Extensions view by clicking the Extensions icon in the Activity Bar on the side of the window or by pressing `Ctrl+Shift+X` (Windows/Linux) or `Cmd+Shift+X` (macOS). |
| 31 | +3. Search for `mdx`. |
| 32 | +4. Click **Install** on the MDX extension by unifiedjs. |
| 33 | + |
| 34 | +## Steps |
| 35 | + |
| 36 | +1. **Open the Repository Folder**: |
| 37 | + - In VS Code, go to `File > Open Folder...` (or `File > Open...` on macOS). |
| 38 | + - Navigate to the cloned `docs` repository folder on your local machine and open it. |
| 39 | + |
| 40 | +2. **Start Editing**: |
| 41 | + - Open VS Code's File Explorer (left sidebar) and navigate to these key directories: |
| 42 | + - **`content/docs/`** - Contains all documentation `.mdx` files you'll be editing |
| 43 | + - **`public/assets/`** - Stores images and static assets referenced in documentation |
| 44 | + - _**`src/`** - Contains site source code (no editing needed here)_ |
| 45 | + - Select any `.mdx` file to begin editing. With the MDX extension installed, you'll get: |
| 46 | + - Syntax highlighting for Markdown and JSX |
| 47 | + - IntelliSense suggestions |
| 48 | + - Error checking |
| 49 | + <Callout type="warn" title="Image Paths"> |
| 50 | + When adding images, reference them from `/assets` (not `/public/assets`). Example: |
| 51 | + ``` |
| 52 | +  |
| 53 | + ``` |
| 54 | + </Callout> |
| 55 | + |
| 56 | +3. **Using Fumadocs Components**: |
| 57 | + - Our documentation uses [Fumadocs UI](https://fumadocs.vercel.app/docs/ui) components like `<Callout />`, `<Tabs />`, `<Steps />`, etc. |
| 58 | + - You can use these components directly within your `.mdx` files. |
| 59 | + - **Global Components:** Components like `<Callout />` are globally available and don't require an explicit import. |
| 60 | + - **Imported Components:** Components like `<Tabs />` or `<Steps />` need to be imported at the top of the `.mdx` file. Check existing files or the Fumadocs documentation for import examples. |
| 61 | + ```ts |
| 62 | + import { Tabs, Tab } from 'fumadocs-ui/components/tabs'; |
| 63 | + import { Steps, Step } from 'fumadocs-ui/components/steps'; |
| 64 | + ``` |
| 65 | + - Refer to the [Fumadocs UI Documentation](https://fumadocs.vercel.app/docs/ui) for details on available components and their usage. |
| 66 | + |
| 67 | +4. **Run the Development Server** (Recommended): |
| 68 | + - Open a terminal within VS Code (`Terminal > New Terminal`). |
| 69 | + - Run the command `npm run dev`. |
| 70 | + - This will start the development server, usually accessible at `http://localhost:3000`. |
| 71 | + - The site will automatically update in your browser as you save changes to the `.mdx` files. |
| 72 | + |
| 73 | +4. **Follow Contribution Steps**: |
| 74 | + - Once you've made your changes, follow the standard contribution steps outlined in the main [Docs Contribution Guide](/contribute/docs#writing-guidelines): commit your changes, push them to your fork, and create a pull request. |
| 75 | + |
| 76 | +Using VS Code with the MDX extension provides a robust environment for contributing to the Zen Browser documentation. |
0 commit comments